arrays.js is part of Aloha Editor project http://www.alohaeditor.org
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
Methods
-
Coerces the given object (NodeList, arguments) to an array.
This implementation works on modern browsers and IE >= 9. For IE
< 9 a shim can be used, available here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sliceName Type Description arrayLikeObject
* -
Returns true if the given Array `xs` contains the value `x`.
Name Type Description xs
Array x
* A value to search for in the given array. Returns:
of argument `x` is an element of the set `xs`.
-
Returns the relative difference of array `zs` in `xs`:
All items in the array `xs` that are not contained in array `zs`.Name Type Description xs
Array zs
Array Returns:
difference of the sets `xs` and `zs`.
-
Does a shallow compare of two arrays.
Name Type Description a
Array An array to compare. b
Array A second array to compare with `a`. equalFn
function A custom comparison function that accepts two values a and b from the given arrays and returns true or false for equal and not equal respectively. If no equalFn is provided, the algorithm will use the strict equals operator. Returns:
if all items in a and b are equal, false if not.
-
Returns all items in the array `xs` that are also contained in array
`zs`.Name Type Description xs
Array zs
Array Returns:
intersection of the sets `xs` and `zs`.
-
Returns true if the given value is an array.
-
Returns the last item in the given Array.
Name Type Description xs
Array Returns:
item in xs, or null if the given array is empty.
-
Like Array.prototype.map() except expects the given function to return
arrays which will be concatenated together into the resulting array.
Related to partition() in the sense that
mapcat(partition(xs, n), identity) == xs.
Don't use Array.prototype.concat.apply():
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
"The consequences of applying a function with too many arguments
(think more than tens of thousands of arguments) vary across
engines (JavaScriptCore has hard-coded argument limit of 65536),
because the limit (indeed even the nature of any
excessively-large-stack behavior) is unspecified. "Name Type Description xs
Array.<*> fn
function -
Partitions the given array xs into an array of arrays where each
nested array is a subsequence of xs of length n.
See mapcat().Name Type Description xs
Array.<*> n
number -
This function is missing documentation.
- TODO
-
- Complete documentation.
-
Similar to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
Except, instead of returning true, returns the first value in the array
for which the `pred` returns true.Name Type Description xs
Array.<*> pred
function Returns:
of xs
-
Similar to some(), except that it returns an index into the given array
for the first element for which `pred` returns true.
If none return true, -1 is returned.Name Type Description xs
Array.<*> pred
function -
Splits the list into two parts using the given predicate.
The first element will be the "prefix," containing all elements of `list` before
the element that returns true for the predicate.
The second element is equal to dropWhile(list).Name Type Description list
Array.<*> predicate
function Returns:
prefix and suffix of `list`
-
Creates a new array that contains a unique list of entries
created from the old array. Example:
[1, 2, 2, 3, 2, 4] => [1, 2, 3, 4]Name Type Description arr
Array.<*>