Array

Methods

absorb(arr) → {Array}

Absorb (push) every item of given array to this Array
Parameters:
Name Type Description
arr Array Array to be absorbed
Returns:
Array - this

clone() → {Array}

Clone this Array
Returns:
Array - Clone of this Array

diff(arr) → {Array}

Returns the difference between this Array and given in argument
Parameters:
Name Type Description
arr Array Array to compare
Returns:
Array - Array with elements that are different

empty() → {Array}

Empty this Array
Returns:
Array - this

filterLike(query) → {Array}

Returns the new array based on current one by filtering according to query
Parameters:
Name Type Description
query Object Query
Returns:
Array - New Array with matching elements
See:
  • Object#isLike

lookFor(query) → {number}

Look for index of item matching to query
Parameters:
Name Type Description
query Object Query
Returns:
number - Index of matching index; -1 if not found

shuffle() → {Array}

Shuffle this Array
Returns:
Array - this

unique() → {Array}

Unique this Array - remove all duplicate items
Returns:
Array - this

static deepCloneArrayOfObjects(arr) → {Array.<Object>}

Deep clone array of object
Parameters:
Name Type Description
arr Array of objects
Returns:
Array.<Object> - Clone of arr

static isEmpty(arr) → {boolean}

Checks is given value is Array and is empty
Parameters:
Name Type Description
arr Array Something to check
Returns:
boolean - Verdict

static isInvalidOrEmpty(arr) → {boolean}

Checks is given value isn't Array or is empty
Parameters:
Name Type Description
arr Array Something to check
Returns:
boolean - Verdict

static isNotEmpty(arr) → {boolean}

Checks is given value is Array and is non-empty
Parameters:
Name Type Description
arr Array Something to check
Returns:
boolean - Verdict

static sortArrayOfObjects(arr, propertyName, descendingopt)

Sort array of objects
Parameters:
Name Type Attributes Default Description
arr Array.<Object> Array of objects that should be sorted
propertyName string Name of property by which sorting will be done
descending boolean <optional>
false Flag to sort in descending order

static wrap(something) → {Array}

Wrap in Array if @param is not an Array already
Parameters:
Name Type Description
something * | Array Something that should be an Array
Returns:
Array