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

x/froebel/list.ts

A strictly typed utility library.
Go to Latest
import * as froebel from "https://deno.land/x/froebel@v0.21.3/list.ts";

Variables

Access list at i % length. Negative indexes start indexing the last element as [-1] and wrap around to the back.

Takes a list and returns it in multiple smaller lists of the size batchSize. The last batch may be smaller than batchSize depending on if list size is divisible by batchSize.

Takes a list and returns a pair of lists containing: the elements that match the predicate and those that don't, respectively.

Creates a range between two values.

Shuffles list using the Fisher-Yates shuffle algorithm. The original list is not modified and the shuffled list is returned.

Same as shuffle but shuffles list in place.

Takes n elements from the iterable list and returns them as an array.

Reverse of zip. Takes a list of tuples and deconstructs them into an array (of length of the tuples length) of lists each containing all the elements in all tuples at the lists index.

Same as unzip but accepts an unzipper function for each tuple index. The unzipper's return value is used as the value in the list at that index returned from unzipWith.

Takes multiple lists and returns a list of tuples containing the value in each list at the current index. If the lists are of different lengths, the returned list of tuples has the length of the shortest passed in list.

Same as zip but also takes a zipper function, that is called for each index with the element at current index in each list as arguments. The result of zipper is the element at current index in the list returned from zipWith.

Functions

Constructs a range between characters.

Constructs a numeric between start and end inclusively.