utiljs-arraysdeprecated

JavaScript utility methods for arrays

Usage no npm install needed!

<script type="module">
  import utiljsArrays from 'https://cdn.skypack.dev/utiljs-arrays';
</script>

README

utiljs-arrays

JavaScript utility methods for arrays

NPM Status Travis CI Build Status

utiljs-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