Class: Array

Array

new Array()

Source:

Methods

(static) from(object, mapFunctionopt, thatopt) → {Array}

Parameters:
Name Type Attributes Description
object Object Array-like object
mapFunction function <optional>
(this = that, value, key)
that * <optional>
Source:
Returns:
Type
Array

(static) is(value) → {Boolean}

Determines whether the given value is an array.
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

(static) isArray(value) → {Boolean}

Alias for Array.is
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

add(items) → {this}

Adds items to the array.
Parameters:
Name Type Description
items Array
Source:
Returns:
Type
this

each(callback, fromIndexopt, toIndexopt) → {this}

Executes the given function for every item in the array.
Parameters:
Name Type Attributes Description
callback function (this = this, value, index, array = this)
fromIndex Number <optional>
inclusive
toIndex Number <optional>
exclusive
Source:
Returns:
Type
this

every(callback, thatopt) → {Boolean}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
Boolean

filter(callback, thatopt) → {Array}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
Array

find(callback, thatopt) → {*}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
*

findIndex(callback, thatopt) → {Number}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
Number

first() → {*}

Source:
Returns:
Type
*

forEach(callback, thatopt)

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:

indexOf(value, fromopt) → {Number}

Parameters:
Name Type Attributes Description
value *
from Number <optional>
Source:
Returns:
Type
Number

insert(index, items) → {this}

Inserts the given items in the array at the given index.
Parameters:
Name Type Description
index Number
items Array
Source:
Returns:
Type
this

last() → {*}

Source:
Returns:
Type
*

lastIndexOf(value, fromopt) → {Number}

Parameters:
Name Type Attributes Description
value *
from Number <optional>
Source:
Returns:
Type
Number

map(callback, thatopt) → {Array}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
Array

reduce(callback, currentopt) → {Array}

Parameters:
Name Type Attributes Default Description
callback Array.ReduceCallback
current * <optional>
this.first()
Source:
Returns:
Type
Array

reduceRight(callback, currentopt) → {Array}

Parameters:
Name Type Attributes Default Description
callback Array.ReduceCallback
current * <optional>
this.last()
Source:
Returns:
Type
Array

remove(item) → {this}

Removes the item (if it is in the array) from the array.
Parameters:
Name Type Description
item *
Source:
Returns:
Type
this

removeAt(indexopt, amountopt) → {this}

Removes an item at the given index from the array.
Parameters:
Name Type Attributes Default Description
index Number <optional>
0
amount Number <optional>
1
Source:
Returns:
Type
this

some(callback, thatopt) → {Boolean}

Parameters:
Name Type Attributes Description
callback Array.Callback
that * <optional>
Source:
Returns:
Type
Boolean

tack(…items) → {this}

Similar to Array#add, but accepts items as arguments.
Parameters:
Name Type Attributes Description
items * <repeatable>
Source:
Returns:
Type
this

Type Definitions

Callback(value, index, array) → {undefined|Boolean|*}

This:
  • that
Parameters:
Name Type Description
value *
index Number
array Array
Source:
Returns:
Type
undefined | Boolean | *

ReduceCallback(current, value, index, array) → {*}

Parameters:
Name Type Description
current *
value *
index Number
array Array
Source:
Returns:
Passed as the next `current`.
Type
*