Skip to main content
Module

x/arrays/mod.ts

Provides utility methods for common Array operations
Latest
import * as arrays from "https://deno.land/x/arrays@v1.0.21/mod.ts";

Namespaces

Extends Array.Prototype with the below functions.

Utility methods for Iterables.

Functions

Returns an array split into chunks. If the array can't be split equally based on the given size, the last chunk will be the remaining elements.

Returns the common values from all the given arrays.

Returns an array with all falsey values (false, null, 0, '', undefined, and NaN) removed.

Checks if all the elements in the source array are present in the other arrays (args).

Returns the unique elements in an array compared to the rest of the arrays (args).

Flattens an arrays of arrays into a single array.

Flattens an array and checks if all the elements are of the specified type.

Merge the elements from the rest of the arrays (args) to the first array. A nested array will be considered as a single value.

Returns an array without the values passed as args.

Converts the nested arrays of an array into a single object of key-value pairs.

Returns the unique values from a given array. Optionally pass in a boolean to specify if the result should be sorted.

Returns the size of an Iterable. In order to reuse the Iterable that was passed, make sure to convert it to a MultipleIterable first.

Iterating over an iterator is said to consume the iterator, because it is generally only possible to do once. This method returns an Iterable that can be iterated multiple times (e.g. in multiple for...of loops)