Built-In Namespace Array
Method Attributes | Method Name and Description |
---|---|
all(fn, ctx)
Checks if all items in this array pass the provided test.
|
|
copy()
Creates a copy of this array.
|
|
<static> |
Array.create(o)
Creates an array from an array-like object.
|
detect()
Alias of filterOne.
|
|
each()
Alias of forEach.
|
|
eachProperty(p, fn, ctx)
Gets a propertie's value for each object in the array.
|
|
equals(a)
Checks that the passed array equals this one at each index.
|
|
filter(fn, ctx)
Creates an array containing only the elements in this one for
which the filtering function returns true.
|
|
filterOne(fn, ctx)
The same as filter, but only returning the first match.
|
|
first()
Gets the array's first item.
|
|
flatten()
Creates a flattened array, merging down all sub-arrays.
|
|
forEach(fn, ctx)
Runs the provided function for each item in this array.
|
|
includes(item)
Checks if the array includes an item identical to the one passed.
|
|
init()
Gets all but the last item of the array.
|
|
invoke(name, args, ctx)
Calls the property, if present, on each item in this array,
returning a list of results.
|
|
last()
Gets the last item of the array.
|
|
map(fn, ctx)
Creates an array containing the values of a function applied to
each item in the array.
|
|
partition(fn, ctx)
Splits this array in two based on the return value of the
partitioning function.
|
|
pluck()
Alias of eachProperty.
|
|
reduce(fn, init, ctx)
Processes the items of an array from left to right, applying the
reducing function to each item.
|
|
remove(o)
Removes all items matching the passed object.
|
|
select()
Alias of filter.
|
|
some(fn, ctx)
Checks if any item in this array passes the provided test.
|
|
subtract(a, v)
Returns an array containing all items not identical to those in the
passed array.
|
|
<static> |
Array.test(o)
Checks if the object is an array.
|
unique()
Returns an array containing only items with unique identity.
|
|
zip(arr)
Creates an array containing arrays of each item at each index.
|
Method Detail
{Boolean}
all(fn, ctx)
Checks if all items in this array pass the provided test.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The filtering function.
- {Object} ctx
- The function's execution context.
- Returns:
- {Boolean} If each item passes.
{Array}
copy()
Creates a copy of this array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Array} The copy.
<static>
{Array}
Array.create(o)
Creates an array from an array-like object.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Object} o
- The source object
- Returns:
- {Array} The new array
detect()
Alias of filterOne.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
each()
Alias of forEach.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
{Array}
eachProperty(p, fn, ctx)
Gets a propertie's value for each object in the array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {String} p
- The property value to retrieve.
- {Function} fn
- true if the property is a function and should be called.
- {Object} ctx
- The function's execution context.
- Returns:
- {Array} Each property's value.
{Boolean}
equals(a)
Checks that the passed array equals this one at each index.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Array} a
- The array to check
- Returns:
- {Boolean} true if equal, false if not
{Array}
filter(fn, ctx)
Creates an array containing only the elements in this one for
which the filtering function returns true.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The filtering function.
- {Object} ctx
- The function's execution context.
- Returns:
- {Array} The filtered array.
{Object}
filterOne(fn, ctx)
The same as filter, but only returning the first match.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The filtering function.
- {Object} ctx
- The function's execution context.
- Returns:
- {Object} The first filtered item, if found.
{Object}
first()
Gets the array's first item.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Object} The first item.
{Array}
flatten()
Creates a flattened array, merging down all sub-arrays.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Array} The flattened array.
forEach(fn, ctx)
Runs the provided function for each item in this array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The function to run.
- {Object} ctx
- The function's execution context.
{Boolean}
includes(item)
Checks if the array includes an item identical to the one passed.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Object} item
- The item to check.
- Returns:
- {Boolean} true if the item was found, false if not.
{Array}
init()
Gets all but the last item of the array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Array} The array's init.
{Array}
invoke(name, args, ctx)
Calls the property, if present, on each item in this array,
returning a list of results. If the named property is not present
on a given item, undefined will pushed on the result list.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {String} name
- The property name to call.
- {Array} args
- An argument list that will be provided with each call.
- {Object} ctx
- The function's execution context.
- Returns:
- {Array} The return value of each call.
{Object}
last()
Gets the last item of the array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Object} The array's last item.
{Array}
map(fn, ctx)
Creates an array containing the values of a function applied to
each item in the array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
[1, 2, 3].map(function (n, i, a) { return n * i; }; // [0, 2, 6]
- Parameters:
- {Function} fn
- The map function
- {Object} ctx
- The function's execution context, called with (value, index, array)
- Returns:
- {Array} The mapped array
{Array}
partition(fn, ctx)
Splits this array in two based on the return value of the
partitioning function. The first array contains all positives and
the second all negatives.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The partition function.
- {Object} ctx
- The function's execution context.
- Returns:
- {Array} The array of paritions.
pluck()
Alias of eachProperty.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
{Object}
reduce(fn, init, ctx)
Processes the items of an array from left to right, applying the
reducing function to each item.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The function that is called with each iteration. This function is provided with the following arguments: - The result of the previous iteration - The current item - The current item's index - The array
- {Object} init
- A value to be used as the previous value in the first iteration.
- {Object} ctx
- The context in which to apply the function.
- Returns:
- {Object} The reduced value.
{Boolean}
remove(o)
Removes all items matching the passed object.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Object} o
- The object to remove.
- Returns:
- {Boolean} true if the object was removed, false if not.
select()
Alias of filter.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
{Boolean}
some(fn, ctx)
Checks if any item in this array passes the provided test.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Function} fn
- The filtering function.
- {Object} ctx
- The function's execution context.
- Returns:
- {Boolean} If any item passes.
{Array}
subtract(a, v)
Returns an array containing all items not identical to those in the
passed array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Array} a
- The array of of objects to filter.
- {Boolean} v
- true to check value rather than identity.
- Returns:
- {Array} The array with none of the passed objects.
<static>
{Boolean}
Array.test(o)
Checks if the object is an array.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Parameters:
- {Object} o
- The object to check.
- Returns:
- {Boolean} true if it is an array, false if not.
{Array}
unique()
Returns an array containing only items with unique identity.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
- Returns:
- {Array} The array with no duplicate objects.
{Array}
zip(arr)
Creates an array containing arrays of each item at each index.
Defined in: nativelib-dev.js.
Defined in: nativelib-dev.js.
[1, 2, 3].zip([4, 5, 6]); // [[1, 4], [2, 5], [3, 6]]
- Parameters:
- {Array} arr
- The array to zip.
- Returns:
- {Array} The zipped array.