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

std/collections/mod.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
import * as mod from "https://deno.land/std@0.105.0/collections/mod.ts";

Functions

Transforms the given array into a Record, extracting the key of each element using the given selector. If the selector produces the same key for multiple elements, the latest one will be used (overriding the ones before it).

Splits the given array into chunks of the given size and returns them

Merges the two given Records, recursively merging any nested Records with the second collection overriding the first in case of conflict

Returns all distinct elements in the given array, preserving order by first occurence

Returns all elements in the given array that produce a distinct value using the given selector, preserving order by first occurence

Returns a new record with all entries of the given record except the ones that do not match the given predicate

Returns a new record with all entries of the given record except the ones that have a key that does not match the given predicate

Returns a new record with all entries of the given record except the ones that have a value that does not match the given predicate

Returns the last element in the given array matching the given predicate

Returns the index of the last element in the given array matching the given predicate

Applies the given selector to each element in the given array, returning a Record containing the results as keys and all values that produced that key as values.

Returns all distinct elements that appear at least once in each of the given arrays

Applies the given transformer to all entries in the given record and returns a new record containing the results

Applies the given transformer to all keys in the given record's entries and returns a new record containing the transformed entries.

Returns a new array, containing all elements in the given array transformed using the given transformer, except the ones that were transformed to null or undefined

Applies the given transformer to all valuesin the given record and returns a new record containing the resulting keys associated to the last value that produced them.

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

Builds all possible orders of all elements in the given array Ignores equality of elements, meaning this will always reutrn the same number of permutations for a given length of input.

Returns all elements in the given collection, sorted stably by their result using the given selector

Applies the given selector to all elements in the given collection and calculates the sum of the results

Returns all distinct elements that appear in any of the given arrays

Builds two separate arrays from the given array of 2-tuples, with the first returned array holding all first tuple elements and the second one holding all the second elements

Builds 2-tuples of elements from the given array with matching indices, stopping when the smaller array's end is reached

Type Aliases

Merge deeply two objects

Deep merge options

Merging strategy