arrayer

Utilities for JS arrays.

Usage no npm install needed!

<script type="module">
  import arrayer from 'https://cdn.skypack.dev/arrayer';
</script>

README

npm (scoped)

Arrayer

Some handy array-related functions.

Functions

equal(arr1, arr2)boolean

Compare two arrays and check if they are the same.

arrange(...arrays)Array.<any>

Arrange various arrays into a single one.

remove(item, arr)Array.<any>

Removes the first match of the specified item.

removeAll(item, arr)Array.<any>

Removes all matches of the specified item.

longestString(arr)Object

Get the longest string of an array.

highestNumber(arr)number

Get the highest value of a numeric array.

equal(arr1, arr2) ⇒ boolean

Compare two arrays and check if they are the same.

Kind: global function Returns: boolean - Whether they are the same or not. Author: ThePhoDit

Param Type Description
arr1 Array.<any> First array.
arr2 Array.<any> Second array.

arrange(...arrays) ⇒ Array.<any>

Arrange various arrays into a single one.

Kind: global function Returns: Array.<any> - Array with all values. Author: ThePhoDit

Param Type Description
...arrays Array.<any> All arrays to arrange.

remove(item, arr) ⇒ Array.<any>

Removes the first match of the specified item.

Kind: global function Returns: Array.<any> - Array without the removed item. Author: ThePhoDit

Param Type Description
item string | number | boolean The item to remove.
arr Array.<(string|number|boolean)> The array from where the item is removed.

removeAll(item, arr) ⇒ Array.<any>

Removes all matches of the specified item.

Kind: global function Returns: Array.<any> - Array without the removed items. Author: ThePhoDit

Param Type Description
item string | number | boolean The item to remove.
arr Array.<(string|number|boolean)> The array from where the item is removed.

longestString(arr) ⇒ Object

Get the longest string of an array.

Kind: global function Returns: Object - The word and the length of it. Author: ThePhoDit

Param Type Description
arr Array.<string> Array with different words.

highestNumber(arr) ⇒ number

Get the highest value of a numeric array.

Kind: global function Returns: number - The highest number. Author: ThePhoDit

Param Type Description
arr Array.<number> Array with different numbers.