@util.js/arrays

0.41.3 • Public • Published

@util.js/arrays

JavaScript utility methods for arrays

NPM Status Travis CI Build Status

@util.js/arrays is part of Util.js.

This class contains all the non-instance methods of Array in addition to:

Arrays API

Kind: global class
Access: public

arrays.from(arrayLike, [mapFn], [thisArg]) ⇒ Array

Creates a new, shallow-copied Array instance from an array-like or iterable object.

See MDN's documentation about from.

Kind: instance method of Arrays
Returns: Array - A new Array instance
Access: public

Param Type Description
arrayLike An array-like or iterable object to convert to an array
[mapFn] function Map function to call on every element of the array
[thisArg] Object Value to use as this when executing mapFn

arrays.isArray(obj) ⇒ boolean

Determines whether the passed value is an Array.

See MDN's documentation about isArray.

Kind: instance method of Arrays
Returns: boolean - true if the object is an Array or false otherwise
Access: public

Param Type Description
obj * The object to be checked

arrays.of(...elementN) ⇒ Array

Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments

See MDN's documentation about of.

Kind: instance method of Arrays
Returns: Array - A new Array instance
Access: public

Param Type Description
...elementN * Elements of which to create the array

arrays.shuffle(array) ⇒ Array

Shuffles the elements of the specified array.

See knuth-shuffle.

Kind: instance method of Arrays
Returns: Array - A new Array instance
Access: public

Param Type Description
array Array The array to shuffle

Dependents (0)

Package Sidebar

Install

npm i @util.js/arrays

Weekly Downloads

0

Version

0.41.3

License

MIT

Unpacked Size

14.9 kB

Total Files

7

Last publish

Collaborators

  • creemama