Skip to main content

Array Helpers

Utility functions for working with arrays.

Functions

FunctionDescription
arrayEqualsSimple helper that checks if two lists are identical.
chunkChunks an array into smaller arrays of specified size
deepCompareDeep comparison of two arrays that only returns true or false.
differenceReturns the difference between two arrays (items in first array but not in second)
intersectionCompute the intersection of two arrays, meaning the elements that are present
oneInCommonSimple helper that check if two lists shared at least an item in common.
quickCompareQuick comparison of two arrays using JSON.stringify.
sortNumberAscFnSort numbers in ascending order
sortNumberDescFnSort numbers in descending order
sortStringAscFnSort strings in ascending order
sortStringDescFnSort strings in descending order
sortStringAscInsensitiveFnSort strings in ascending order (case insensitive)
createSortByStringFnCreates a sort function for objects by string property
createSortByNumberFnCreates a sort function for objects by number property
createSortByDateFnCreates a sort function for objects by date property
uniqueRemoves duplicate values from an array