Array micro library focused on speed
Examples are provided with the included documentation, found in ./doc
.
Adds arg
to obj
if it is not found in obj
Performs a binary search on obj
(must be sorted) for arg
Returns an Object (NodeList, etc.) as an Array; if keys
is true you will get the keys of the Object
Transforms an Array to a 2D Array of chunks
Clears an Array without destroying it
Clones an Array, shallow
defaults to true
Determines if obj
contains arg
Creates a new Array of the result of fn
executed against every index of obj
Compacts a Array by removing null
or undefined
indices; returns null
if diff
is true
and there is no difference
Counts the occurrence of arg
in obj
Finds the difference between two Arrays
Iterates obj
and executes fn
with arguments [value
, index
]; returning false
from fn
halts iteration
Like each()
, but in reverse
Determines if an Array is empty
Determines if two Arrays are equal
Fills obj
with the evalution of arg
, optionally from start
to offset
Returns the first index
Flattens a 2D Array
Like each()
, iterates obj
and executes fn
with arguments [value
, index
]; returning false
from fn
halts iteration
Creates a 2D Array from an Object
Facade of indexOf()
Returns an Associative Array as an Indexed Array
Finds the intersections between two Arrays
Resizes obj
by keeping every index which fn
evaluates to true
Returns the keys in an Associative Array, e.g. an Object
Sorts an Array based on key values, like an SQL ORDER BY clause
Returns the last index of the Array, with an optional offset
from the end to retrieve a range
Returns a limited range of indices from the Array
Finds the maximum value in an Array
Finds the mean of an Array
Finds the median value of an Array
Merges obj2
into obj1
, excluding duplicate indices
Finds the minimum value in an Array
Mingles Arrays and returns a 2D Array, corresponding index positions are paired
Finds the mode value of an Array
Finds the range of the Array
Searches a 2D Array obj
for the first match of arg
as a second index
Returns Array containing the items in obj
for which fn
is not true
Removes indices from an Array without recreating it
Deletes every index of obj
for which fn
evaluates to true
Deletes indices of obj
until fn
evaluates to false
Replaces the contents of obj1
with obj2
Returns the "rest" of obj
, offset
defaults to 1
Finds the last index of arg
in obj
Returns new Array with arg
moved to the first index
Generates a series Array
Sorts the Array by parsing values, to be used with [].sort()
Sorts obj
using sort
Splits an Array by divisor arg
, e.g. retsu.split(new Array(100), 21)
Finds the standard deviation of an Array
Gets the summation of an Array
Takes the first n
indices from obj
Casts an Array to Object
Gets the total keys in an Array
Returns an Array of unique indices of obj
Finds the variance of an Array
Converts args
to Array, then merges elements of obj
with corresponding elements from each argument