Javascript

Cast a value as an array

This function checks if a value is already an array, and if not, it wraps the value in an array.…

Check if an array is empty

This function checks whether an array is empty. JavaScript: TypeScript:

Clone an array

This function clones an array, creating a new array with the same elements. JavaScript: TypeScript:

Compare two sets

This function compares two sets for equality, regardless of the order of elements. JavaScript: TypeScript:

Find the maximum item of a set

This function returns the maximum value from a set. JavaScript: TypeScript:

Find the minimum item of a set

This function returns the minimum value from a set. JavaScript: TypeScript:

Remove an item from a set

This function removes an item from a set. JavaScript: TypeScript:

Shuffle an array

This function shuffles the elements of an array. JavaScript: TypeScript:

Remove falsy values from array

This function removes all ‘falsy’ values (false, null, 0, ”, undefined, and NaN) from an array. JavaScript: TypeScript:

Split an array into chunks

This function splits an array into chunks of a specified size. JavaScript: TypeScript: