Method binIndex
Preforms a binary search on a sorted Array
Parameters:
obj must be an Array.
(Array to search)
arg can be of any type.
(Value to find index of)
Returns a Number
(Index of arg
within obj
)
Method cast
Returns an Object ( NodeList, etc. ) as an Array
Parameters:
obj must be an Object.
(Object to cast)
key must be a Boolean.
([Optional] Returns key or value, only applies to Objects without a length property)
Returns an Array
(Object as an Array)
Method chunk
Transforms an Array to a 2D Array of chunks
Parameters:
obj must be an Array.
(Array to parse)
size must be a Number.
(Chunk size ( integer ))
Returns an Array
(Chunked Array)
Method clear
Clears an Array without destroying it
Parameters:
Returns an Array
(Cleared Array)
Method clone
Clones an Array
Parameters:
Returns an Array
(Clone of Array)
Method contains
Determines if obj contains arg
Parameters:
obj must be an Array.
(Array to search)
arg can be of any type.
(Value to look for)
Returns a Boolean
(True if found, false if not)
Method collect
Creates a new Array of the result of fn
executed against every index of obj
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to execute against indices)
Returns an Array
(New Array)
Method compact
Compacts a Array by removing null
or undefined
indices
Parameters:
obj must be an Array.
(Array to compact)
diff must be a Boolean.
(Indicates to return resulting Array only if there's a difference)
Returns an Array
(Compacted copy of obj
, or null ( if diff
is passed & no diff is found ))
Method count
Counts value
in obj
Parameters:
obj must be an Array.
(Array to search)
value can be of any type.
(Value to compare)
Returns an Array
(Array of counts)
Method diff
Finds the difference between array1 and array2
Parameters:
array1 must be an Array.
(Source Array)
array2 must be an Array.
(Comparison Array)
Returns an Array
(Array of the differences)
Method each
Iterates obj and executes fn Parameters for fn are 'value', 'index'
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to execute on index values)
async must be a Boolean.
([Optional] Asynchronous iteration)
size must be a Number.
([Optional] Batch size for async iteration, default is 10)
Returns an Array
(Array)
Method empty
Determines if an Array is empty
Parameters:
Returns a Boolean
(true
if there's no indices)
Method equal
Determines if a
is equal to b
Parameters:
a must be an Array.
(Array to compare)
b must be an Array.
(Array to compare)
Returns a Boolean
(true
if the Arrays match)
Method fib
Fibonacci generator
Parameters:
Returns an Array
(Array of numbers)
Subtracting 1 to account for first
& second
Method fill
Fills obj
with the evalution of arg
, optionally from start
to offset
Parameters:
obj must be an Array.
(Array to fill)
arg can be of any type.
(String, Number of Function to fill with)
start must be a Number.
([Optional] Index to begin filling at)
end must be a Number.
([Optional] Offset from start to stop filling at)
Returns an Array
(Filled Array)
Method first
Returns the first Array node
Parameters:
Returns a Mixed
(The first node of the array)
Method flat
Flattens a 2D Array
Parameters:
Returns an Array
(Flatten Array)
Method fromObject
Creates a 2D Array from an Object
Parameters:
Returns an Array
(2D Array)
Method index
Facade to indexOf for shorter syntax
Parameters:
obj must be an Array.
(Array to search)
arg can be of any type.
(Value to find index of)
Returns a Number
(The position of arg in instance)
Method indexed
Returns an Associative Array as an Indexed Array
Parameters:
Returns an Array
(Indexed Array)
Method intersect
Finds the intersections between array1 and array2
Parameters:
array1 must be an Array.
(Source Array)
array2 must be an Array.
(Comparison Array)
Returns an Array
(Array of the intersections)
Method keepIf
Keeps every element of obj
for which fn
evaluates to true
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to test indices against)
Returns an Array
(Array)
Method sort
Sorts an Array based on key values, like an SQL ORDER BY clause
Parameters:
obj must be an Array.
(Array to sort)
query must be a String.
(Sort query, e.g. "name, age desc, country")
sub must be a String.
([Optional] Key which holds data, e.g. "{data: {}}" = "data")
Returns an Array
(Sorted Array)
Method keys
Returns the keys in an "Associative Array"
Parameters:
Returns an Array
(Array of the keys)
Method last
Returns the last index of the Array
Parameters:
obj must be an Array.
(Array)
arg must be a Number.
([Optional] Negative offset from last index to return)
Returns a Mixed
(Last index( s ) of Array)
Method limit
Returns a limited range of indices from the Array
Parameters:
obj must be an Array.
(Array to iterate)
start must be a Number.
(Starting index)
offset must be a Number.
(Number of indices to return)
Returns an Array
(Array of indices)
Method max
Finds the maximum value in an Array
Parameters:
Returns a Mixed
(Number, String, etc.)
Method mean
Finds the mean of an Array ( of numbers )
Parameters:
Returns a Number
(Mean of the Array ( float or integer ))
Method median
Finds the median value of an Array ( of numbers )
Parameters:
Returns a Number
(Median number of the Array ( float or integer ))
Method merge
Merges arg
into obj
, excluding duplicate indices
Parameters:
obj must be an Array.
(Array to receive indices)
arg must be an Array.
(Array to merge)
Returns an Array
(obj)
Method min
Finds the minimum value in an Array
Parameters:
Returns a Mixed
(Number, String, etc.)
Method mingle
Mingles Arrays and returns a 2D Array
Parameters:
obj1 must be an Array.
(Array to mingle)
obj2 must be an Array.
(Array to mingle)
Returns an Array
(2D Array)
Method mode
Finds the mode value of an Array
Parameters:
Returns a Mixed
(Mode value of the Array)
Counting values
Finding the highest occurring count
Finding values that match the count
Determining the result
Method percents
Creates an Array of percentages from an Array of Numbers (ints/floats)
Parameters:
obj must be an Array.
(Array to iterate)
precision must be a Number.
([Optional] Rounding precision)
total must be a Number.
([Optional] Value to compare against)
Returns an Array
(Array of percents)
Dealing with the awesomeness of JavaScript "integers"
Method range
Finds the range of the Array ( of numbers ) values
Parameters:
Returns a Number
(Range of the array ( float or integer ))
Method rassoc
Searches a 2D Array obj
for the first match of arg
as a second index
Parameters:
obj must be an Array.
(2D Array to search)
arg can be of any type.
(Primitive to find)
Returns a Mixed
(Array or undefined)
Method reject
Returns Array containing the items in obj
for which fn()
is not true
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to execute against obj
indices)
Returns an Array
(Array of indices which fn() is not true)
Method replace
Replaces the contents of obj
with arg
Parameters:
obj must be an Array.
(Array to modify)
arg must be an Array.
(Array to become obj
)
Returns an Array
(New version of obj
)
Method remove
Removes indices from an Array without recreating it
Parameters:
obj must be an Array.
(Array to remove from)
start can be of any type.
(Starting index, or value to find within obj)
end must be a Number.
([Optional] Ending index)
Returns an Array
(Modified Array)
Method removeIf
Deletes every element of obj
for which fn
evaluates to true
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to test indices against)
Returns an Array
(Array)
Method removeWhile
Deletes elements of obj
until fn
evaluates to false
Parameters:
obj must be an Array.
(Array to iterate)
fn must be a Function.
(Function to test indices against)
Returns an Array
(Array)
Method rest
Returns the "rest" of obj
from arg
Parameters:
obj must be an Array.
(Array to parse)
arg must be a Number.
([Optional] Start position of subset of obj
( positive number only ))
Returns an Array
(Array of a subset of obj
)
Method rindex
Finds the last index of arg
in obj
Parameters:
obj must be an Array.
(Array to search)
arg can be of any type.
(Primitive to find)
Returns a Mixed
(Index or undefined)
Method rotate
Returns new Array with arg
moved to the first index
Parameters:
obj must be an Array.
(Array to rotate)
arg must be a Number.
(Index to become the first index, if negative the rotation is in the opposite direction)
Returns an Array
(Newly rotated Array)
Method series
Generates a series Array
Parameters:
start must be a Number.
(Start value the series)
end must be a Number.
([Optional] The end of the series)
offset must be a Number.
([Optional] Offset for indices, default is 1)
Returns an Array
(Array of new series)
Method split
Splits an Array by divisor
Parameters:
obj must be an Array.
(Array to parse)
divisor must be a Number.
(Integer to divide the Array by)
Returns an Array
(Split Array)
Finding the fold
Method sort
Sorts the Array by parsing values
Parameters:
a can be of any type.
(Argument to compare)
b can be of any type.
(Argument to compare)
Returns a Number
(Number indicating sort order)
Method sorted
Sorts obj
using array.sort
Parameters:
Returns an Array
(Sorted Array)
Method stddev
Finds the standard deviation of an Array ( of numbers )
Parameters:
Returns a Number
(Standard deviation of the Array ( float or integer ))
Method sum
Gets the summation of an Array of numbers
Parameters:
Returns a Number
(Summation of Array)
Method take
Takes the first arg
indices from obj
Parameters:
obj must be an Array.
(Array to parse)
arg must be a Number.
(Offset from 0 to return)
Returns an Array
(Subset of obj
)
Method total
Gets the total keys in an Array
Parameters:
Returns a Number
(Number of keys in Array)
Method toObject
Casts an Array to Object
Parameters:
Returns an Object
(New object)
Method unique
Returns an Array of unique indices of obj
Parameters:
Returns an Array
(Array of unique indices)
Method variance
Finds the variance of an Array ( of numbers )
Parameters:
Returns a Number
(Variance of the Array ( float or integer ))
Method zip
Converts any arguments to Arrays, then merges elements of obj
with corresponding elements from each argument
Parameters:
obj must be an Array.
(Array to transform)
args can be of any type.
(Argument instance or Array to merge)
Returns an Array
(Array)
Preparing args
Building result Array
Method add
Parameters:
obj must be an Array.
(Array to receive 'arg')
arg can be of any type.
(Argument to set in 'obj')
Returns an Array
(Array that was queried)