Namespace Iterables

A set of functions for working with async generators/iterators.

Functions marked (S) work with endless iterables. That is, they don't require that an iterable finishes.

Conversions

  • toArray Copy contents of iterable to an array
  • map Yields value from an input iterable transformed (with possible change of type) through a map function. (S)
  • fromArray Yields values from an array over time.
  • fromIterable Yields values from an input iterable over time.

Comparisons

  • every Returns true if predicate is true for every item in iterable
  • equals Returns true if values in two iterables are the same at the same location, judged by a provided equality function
  • max Yields the currently highest max value from an iterable (S)
  • min Yields the currently highest min value from an iterable (S)
  • unique Return a set of unique items, compared by reference. (S)
  • uniqueByValue Return a set of unique items, compared by value. (S)

Filtering/finding

  • filter Yields value from iterator that match a predicate (opposite of dropWhile)
  • dropWhile Yields values from iterator, except those that meet predicate. Opposite of filter
  • find Returns first value from iterator that matches predicate (S)
  • some Returns true if a value matching a predicate is found. (S)
  • reduce Reduce an iterable down to one value using an 'accumulator' function

Reshaping

  • map Yields value from an input iterable transformed (with possible change of type) through a map function. (S)
  • chunks Yields a certain sized 'chunk' of values from iterable as an array (S)
  • concat Yields all the results of each iterable in turn (S)
  • flatten For an input iterator of arrays, returns a flattened set of values
  • slice Take a slice of an iterable
  • zip Combines items at same position from iterables
  • fill Yields a fixed value for every value from an iterable

Iterating

  • forEach Runs a function for each value of iterable (S)

  • until Calls a function for each value of an iterable. Value itself is ignored (unlike a forEach) (S)

Example: Importing

// If library is stored two directories up under `ixfx/`
import { map } from '../../ixfx/dist/iterables.js';
// Import from web
import { map } from 'https://unpkg.com/ixfx/dist/iterables.js'

Index

Namespaces

Type Aliases

Functions