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

x/iter/lib/reducers.ts

A bunch of utilities for working with iterables, many inspired by the native array methods.
Latest
import * as iter from "https://deno.land/x/iter@v3.2.3/lib/reducers.ts";

Functions

Finds the average of all items in it.

Determines whether the specified callback function returns true for all items in an iterable.

Returns the value of the first item in the iterable where predicate is true, and undefined otherwise.

Returns the index of the first item in the iterable where predicate is true, and -1 otherwise.

Determines whether an iterable includes a certain element, returning true or false as appropriate.

Finds the norm of it (distance from the origin).

Finds the product of all items in it.

Calls the specified callback function for all the items in an iterable. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Determines whether the specified callback function returns true for any item in an iterable.

Finds the sum of all items in it.

Interfaces

reduce | reduce accumulator callback.

reduce | reduce stop callback.