Module

base/utils/array

Methods

static avg(array) → {Number}

Return average from given array.
Parameters:
Name Type Description
array Array.<Number> array to check

View Source utils/array.js, line 111

Average of given array.
Number

static clone(array) → {Array}

Clone given array.
Parameters:
Name Type Description
array Array Target array.

View Source utils/array.js, line 69

Cloned array.
Array

static contains(array, item) → {Boolean}

Check whether an array contains an item.
Parameters:
Name Type Description
array Array Target array.
item * Item to test.

View Source utils/array.js, line 14

Boolean

static max(array) → {Number}

Return largest number from given array.
Parameters:
Name Type Description
array Array.<Number> Target array.

View Source utils/array.js, line 79

Largest number of given array.
Number

static min(array) → {Number}

Return smallest number from given array.
Parameters:
Name Type Description
array Array.<Number> Target array.

View Source utils/array.js, line 89

Smallest number of given array.
Number

static random(array) → {*}

Return random element from given array.
Parameters:
Name Type Description
array Array Target array.

View Source utils/array.js, line 24

Random element.
*

static shuffle(array) → {Array}

Shuffle given array.
Parameters:
Name Type Description
array Array Target array.

View Source utils/array.js, line 57

Shuffled array.
Array

static sum(array) → {Number}

Return sum from given array.
Parameters:
Name Type Description
array Array.<Number> Target array.

View Source utils/array.js, line 99

Total sum of given array.
Number

static unique(array) → {Array}

Remove duplicates from array using a reference comparison.
Parameters:
Name Type Description
array Array Target array.

View Source utils/array.js, line 34

Cleaned array.
Array