Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/array/index.ts

A JavaScript extension package for building strong and modern applications.
Latest
import * as ayonliJsext from "https://deno.land/x/ayonli_jsext@v0.9.72/array/index.ts";

Functions for dealing with arrays.

Variables

v
uniq
deprecated
v
uniqBy
deprecated

Functions

Breaks the array into smaller chunks according to the given length.

Counts the occurrence of the element in the array.

Checks if the array ends with the given suffix.

Performs a shallow compare to another array and see if it contains the same elements as this array.

Returns the first element of the array, or undefined if the array is empty. This function is equivalent to arr[0] or arr.at(0).

Groups the items of the array according to the comparable values returned by a provided callback function.

Checks if the array contains another array as a slice of its contents.

Creates a record or map from the items of the array according to the comparable values returned by a provided callback function.

Returns the last element of the array, or undefined if the array is empty. This function is equivalent to arr[arr.length - 1] or arr.at(-1).

Orders the items of the array according to the given callback function.

Returns a tuple of two arrays with the first one containing all elements in the given array that match the given predicate and the second one containing all that do not.

Returns a random element of the array, or undefined if the array is empty.

Reorganizes the elements in the array in random order.

Breaks the array into smaller chunks according to the given delimiter.

Checks if the array starts with the given prefix.

Returns a subset of the array that contains only unique items.

Returns a subset of the array that contains only unique items filtered by the given callback function.