Options
All
  • Public
  • Public/Protected
  • All
Menu

Collection Functions

npm version GitHub issues TypeDoc docs Travis Coveralls Dev Dependencies styled with prettier

Really simple functions for working with built-in collection types, inspired by F#'s collection modules design.

Features

  • Modules for iterables, arrays, maps and sets.
  • Composable functional design with full type-safety when used with TypeScript.

Installation

Add package using NPM or yarn

npm i --save collection-fns
yarn add collection-fns

You can import the top level modules directly:

import { Iterables, Arrays, Sets, Maps, pipe } from 'collection-fns'

Additionally, you can import the specific module functions from dist/lib/[module]:

import { groupBy } from 'collection-fns/dist/lib/iterables'

Examples

Calculating primes lazily with iterators:

import { pipe } from 'collection-fns'
import { init, map, filter, count } from 'collection-fns/dist/lib/iterables';

const primes = pipe(
  init({ from: 1, to: 100 }),
  map(x => ({
    x,
    factors: pipe(
      init({ from: 1, to: x }),
      filter(y => x % y === 0)
    )
  })),
  filter(num => count(num.factors) === 2),
  map(num => num.x)
)

for (const prime of primes) {
  console.log(prime)
}

Grouping numbers into odd and even buckets

import { pipe, Maps } from 'collection-fns'
import { init, groupBy } from 'collection-fns/dist/lib/arrays';

const oddAndEven = pipe(
  init({ from: 1, to: 25 }),
  groupBy(i => i % 2 === 0 ? 'even' : 'odd'),
  Maps.ofArray
)

This works by use of partial application, however all functional can also be called directly such as:

Iterables.map(
  Iterables.init({ from: 1, to: 10 }),
  x => x * x))

Pipes

The pipe() function is a stand-in until the pipe (|>) operator gets implemented in ESNext.

For pipes of up to 26 steps, the multi-argument overloads can be used where the first argument is the initial value, and all following arguments are functions take the result of the step before and returning a new result. The result from the final step is then returned as the result of the pipe.

For longer pipes there is an alternative syntax:

  1. The pipe is started by passing pipe(...) a single initial value.
  2. Each .then(...) step in a pipe takes a callback that is passed the value from the previous step.
  3. At the end of the pipe, access the .result property to get the value returned from the last step.

Taking the example from the proposal linked above:

function doubleSay (str) {
  return str + ", " + str;
}
function capitalize (str) {
  return str[0].toUpperCase() + str.substring(1);
}
function exclaim (str) {
  return str + '!';
}

The following statements are equivalent:

let result = exclaim(capitalize(doubleSay("hello")));
result // Prints: "Hello, hello!"

let result = pipe(
  "hello",
  doubleSay,
  capitalize,
  exclaim
)
result // Prints: "Hello, hello!"

let result =
  pipe("hello")
    .then(doubleSay)
    .then(capitalize)
    .then(exclaim)
    .result
result // Prints: "Hello, hello!"

NPM scripts

  • yarn test: Run test suite
  • yarn start: Run yarn build in watch mode
  • yarn test:watch: Run test suite in interactive watch mode
  • yarn test:prod: Run linting and generate coverage
  • yarn build: Generate bundles and typings, create docs
  • yarn lint: Lints code
  • yarn commit: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)

Index

Variables

Const Arrays

Arrays: "/home/travis/build/danielrbradley/collection-fns/src/arrays" = arrays

Const Iterables

Iterables: "/home/travis/build/danielrbradley/collection-fns/src/iterables" = iterables

Const Maps

Maps: "/home/travis/build/danielrbradley/collection-fns/src/maps" = maps

Const Sets

Sets: "/home/travis/build/danielrbradley/collection-fns/src/sets" = sets

Functions

append

  • append<T>(first: ReadonlyArray<T>, second: ReadonlyArray<T>): T[]
  • append<T>(second: T[]): (first: T[]) => T[]
  • append<T>(first: Iterable<T>, second: Iterable<T>): Iterable<T>
  • append<T>(second: Iterable<T>): (first: Iterable<T>) => Iterable<T>
  • append<T>(first: ReadonlySet<T>, second: ReadonlySet<T>): Set<T>
  • append<T>(second: ReadonlySet<T>): (first: ReadonlySet<T>) => Set<T>
  • append<Key, T>(first: ReadonlyMap<Key, T>, second: ReadonlyMap<Key, T>): Map<Key, T>
  • append<Key, T>(second: ReadonlyMap<Key, T>): (first: ReadonlyMap<Key, T>) => Map<Key, T>
  • Wraps the two given arrays as a single concatenated array.

    example

    Arrays.append([1], [2]) // [1, 2] // or using pipe pipe([1], Arrays.append([2])) // [1, 2]

    Type parameters

    • T

    Parameters

    • first: ReadonlyArray<T>

      The first array.

    • second: ReadonlyArray<T>

      The second array.

    Returns T[]

  • Wraps the two given arrays as a single concatenated array.

    example

    Arrays.append([1], [2]) // [1, 2] // or using pipe pipe([1], Arrays.append([2])) // [1, 2]

    Type parameters

    • T

    Parameters

    • second: T[]

      The second array.

    Returns (first: T[]) => T[]

      • (first: T[]): T[]
      • Parameters

        • first: T[]

          The first array.

        Returns T[]

  • Wraps the two given iterables as a single concatenated iterable.

    Type parameters

    • T

    Parameters

    • first: Iterable<T>

      The first iterable.

    • second: Iterable<T>

      The second iterable.

    Returns Iterable<T>

  • Wraps the two given iterables as a single concatenated iterable.

    Type parameters

    • T

    Parameters

    • second: Iterable<T>

      The second iterable.

    Returns (first: Iterable<T>) => Iterable<T>

      • (first: Iterable<T>): Iterable<T>
      • Parameters

        • first: Iterable<T>

          The first iterable.

        Returns Iterable<T>

  • Wraps the two given sets as a single concatenated set. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    Parameters

    • first: ReadonlySet<T>

      The first set.

    • second: ReadonlySet<T>

      The second set.

    Returns Set<T>

  • Wraps the two given sets as a single concatenated set. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    Parameters

    • second: ReadonlySet<T>

      The second set.

    Returns (first: ReadonlySet<T>) => Set<T>

      • (first: ReadonlySet<T>): Set<T>
      • Parameters

        • first: ReadonlySet<T>

          The first set.

        Returns Set<T>

  • Wraps the two given maps as a single concatenated map.

    Type parameters

    • Key

    • T

    Parameters

    • first: ReadonlyMap<Key, T>

      The first map.

    • second: ReadonlyMap<Key, T>

      The second map.

    Returns Map<Key, T>

  • Wraps the two given maps as a single concatenated map.

    Type parameters

    • Key

    • T

    Parameters

    • second: ReadonlyMap<Key, T>

      The second map.

    Returns (first: ReadonlyMap<Key, T>) => Map<Key, T>

      • (first: ReadonlyMap<Key, T>): Map<Key, T>
      • Parameters

        • first: ReadonlyMap<Key, T>

          The first map.

        Returns Map<Key, T>

asIterable

  • asIterable<T>(source: ReadonlySet<T>): Iterable<T>
  • Returns the source, but with the type restricted to being only iterable.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      A map objext to return as an iterable.

    Returns Iterable<T>

choose

  • choose<T, U>(source: ReadonlyArray<T>, chooser: (item: T, index: number) => U | undefined): U[]
  • choose<T, U>(chooser: (item: T, index: number) => U | undefined): (source: ReadonlyArray<T>) => U[]
  • choose<T, U>(source: Iterable<T>, chooser: (item: T, index: number) => U | undefined): Iterable<U>
  • choose<T, U>(chooser: (item: T, index: number) => U | undefined): (source: Iterable<T>) => Iterable<U>
  • choose<T, U>(source: ReadonlySet<T>, chooser: (item: T) => U | undefined): Set<U>
  • choose<T, U>(chooser: (item: T) => U | undefined): (source: ReadonlySet<T>) => Set<U>
  • choose<Key, T, U>(source: ReadonlyMap<Key, T>, chooser: (key: Key, value: T) => U | undefined): Map<Key, U>
  • choose<Key, T, U>(chooser: (key: Key, value: T) => U | undefined): (source: ReadonlyMap<Key, T>) => Map<Key, U>
  • Applies the given function to each element of the array and returns a new array comprised of the results for each element where the function returns a value.

    example

    Arrays.choose( [1, 2, 3], x => (x % 2 === 1 ? x * 2 : undefined) ) // [2, 6] // or using pipe pipe( [1, 2, 3], Arrays.choose(x => (x % 2 === 1 ? x * 2 : undefined)) ) // [2, 6]

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • chooser: (item: T, index: number) => U | undefined

      A function to transform items from the input collection to a new value to be included, or undefined to be excluded.

        • (item: T, index: number): U | undefined
        • Parameters

          • item: T
          • index: number

          Returns U | undefined

    Returns U[]

  • Applies the given function to each element of the array and returns a new array comprised of the results for each element where the function returns a value.

    example

    Arrays.choose( [1, 2, 3], x => (x % 2 === 1 ? x * 2 : undefined) ) // [2, 6]

    // or using pipe pipe( [1, 2, 3], Arrays.choose(x => (x % 2 === 1 ? x * 2 : undefined)) ) // [2, 6]

    Type parameters

    • T

    • U

    Parameters

    • chooser: (item: T, index: number) => U | undefined

      A function to transform items from the input collection to a new value to be included, or undefined to be excluded.

        • (item: T, index: number): U | undefined
        • Parameters

          • item: T
          • index: number

          Returns U | undefined

    Returns (source: ReadonlyArray<T>) => U[]

      • (source: ReadonlyArray<T>): U[]
      • Parameters

        • source: ReadonlyArray<T>

        Returns U[]

  • Applies the given function to each element of the sequence and returns a new sequence comprised of the results for each element where the function returns a value.

    Type parameters

    • T

    • U

    Parameters

    • source: Iterable<T>

      The input collection.

    • chooser: (item: T, index: number) => U | undefined

      A function to transform items from the input collection to a new value to be included, or undefined to be excluded.

        • (item: T, index: number): U | undefined
        • Parameters

          • item: T
          • index: number

          Returns U | undefined

    Returns Iterable<U>

  • Applies the given function to each element of the sequence and returns a new sequence comprised of the results for each element where the function returns a value.

    Type parameters

    • T

    • U

    Parameters

    • chooser: (item: T, index: number) => U | undefined

      A function to transform items from the input collection to a new value to be included, or undefined to be excluded.

        • (item: T, index: number): U | undefined
        • Parameters

          • item: T
          • index: number

          Returns U | undefined

    Returns (source: Iterable<T>) => Iterable<U>

      • (source: Iterable<T>): Iterable<U>
      • Parameters

        • source: Iterable<T>

        Returns Iterable<U>

  • Applies the given function to each element of the set and returns a new set comprised of the results for each element where the function returns a value. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • chooser: (item: T) => U | undefined

      A function to transform items from the input set to a new value to be included, or undefined to be excluded.

        • (item: T): U | undefined
        • Parameters

          • item: T

          Returns U | undefined

    Returns Set<U>

  • Applies the given function to each element of the set and returns a new set comprised of the results for each element where the function returns a value. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • chooser: (item: T) => U | undefined

      A function to transform items from the input set to a new value to be included, or undefined to be excluded.

        • (item: T): U | undefined
        • Parameters

          • item: T

          Returns U | undefined

    Returns (source: ReadonlySet<T>) => Set<U>

      • (source: ReadonlySet<T>): Set<U>
      • Parameters

        • source: ReadonlySet<T>

        Returns Set<U>

  • Applies the given function to each entry of the map and returns a new map comprised of the results for each element where the function returns a value.

    Type parameters

    • Key

    • T

    • U

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • chooser: (key: Key, value: T) => U | undefined

      A function to transform entries from the input map to a new value to be included, or undefined to be excluded.

        • (key: Key, value: T): U | undefined
        • Parameters

          • key: Key
          • value: T

          Returns U | undefined

    Returns Map<Key, U>

  • Applies the given function to each entry of the map and returns a new map comprised of the results for each element where the function returns a value.

    Type parameters

    • Key

    • T

    • U

    Parameters

    • chooser: (key: Key, value: T) => U | undefined

      A function to transform entries from the input map to a new value to be included, or undefined to be excluded.

        • (key: Key, value: T): U | undefined
        • Parameters

          • key: Key
          • value: T

          Returns U | undefined

    Returns (source: ReadonlyMap<Key, T>) => Map<Key, U>

      • (source: ReadonlyMap<Key, T>): Map<Key, U>
      • Parameters

        • source: ReadonlyMap<Key, T>

        Returns Map<Key, U>

collect

  • collect<T, U>(source: ReadonlyArray<T>, mapping: (item: T, index: number) => Iterable<U>): U[]
  • collect<T, U>(mapping: (item: T, index: number) => Iterable<U>): (source: ReadonlyArray<T>) => U[]
  • collect<T, U>(source: Iterable<T>, mapping: (item: T, index: number) => Iterable<U>): Iterable<U>
  • collect<T, U>(mapping: (item: T, index: number) => Iterable<U>): (source: Iterable<T>) => Iterable<U>
  • collect<T, U>(source: ReadonlySet<T>, mapping: (item: T) => Iterable<U>): Set<U>
  • collect<T, U>(mapping: (item: T) => Iterable<U>): (source: ReadonlySet<T>) => Set<U>
  • Applies the given function to each element of the source array and concatenates all the results.

    example

    Arrays.collect([1, 2], x => [x, x]) // [1, 1, 2, 2] // or using pipe pipe([1, 2], Arrays.collect(x => [x, x])) // [1, 1, 2, 2]

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • mapping: (item: T, index: number) => Iterable<U>

      A function to transform elements of the input collection into collections that are concatenated.

        • (item: T, index: number): Iterable<U>
        • Parameters

          • item: T
          • index: number

          Returns Iterable<U>

    Returns U[]

  • Applies the given function to each element of the source array and concatenates all the results.

    example

    Arrays.collect([1, 2], x => [x, x]) // [1, 1, 2, 2] // or using pipe pipe([1, 2], Arrays.collect(x => [x, x])) // [1, 1, 2, 2]

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T, index: number) => Iterable<U>

      A function to transform elements of the input collection into collections that are concatenated.

        • (item: T, index: number): Iterable<U>
        • Parameters

          • item: T
          • index: number

          Returns Iterable<U>

    Returns (source: ReadonlyArray<T>) => U[]

      • (source: ReadonlyArray<T>): U[]
      • Parameters

        • source: ReadonlyArray<T>

        Returns U[]

  • Applies the given function to each element of the source iterable and concatenates all the results.

    Type parameters

    • T

    • U

    Parameters

    • source: Iterable<T>

      The input collection.

    • mapping: (item: T, index: number) => Iterable<U>

      A function to transform elements of the input collection into collections that are concatenated.

        • (item: T, index: number): Iterable<U>
        • Parameters

          • item: T
          • index: number

          Returns Iterable<U>

    Returns Iterable<U>

  • Applies the given function to each element of the source iterable and concatenates all the results.

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T, index: number) => Iterable<U>

      A function to transform elements of the input collection into collections that are concatenated.

        • (item: T, index: number): Iterable<U>
        • Parameters

          • item: T
          • index: number

          Returns Iterable<U>

    Returns (source: Iterable<T>) => Iterable<U>

      • (source: Iterable<T>): Iterable<U>
      • Parameters

        • source: Iterable<T>

        Returns Iterable<U>

  • Applies the given function to each element of the source set and concatenates all the results. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • mapping: (item: T) => Iterable<U>

      A function to transform elements of the input set into collections that are concatenated.

        • (item: T): Iterable<U>
        • Parameters

          • item: T

          Returns Iterable<U>

    Returns Set<U>

  • Applies the given function to each element of the source set and concatenates all the results. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T) => Iterable<U>

      A function to transform elements of the input set into collections that are concatenated.

        • (item: T): Iterable<U>
        • Parameters

          • item: T

          Returns Iterable<U>

    Returns (source: ReadonlySet<T>) => Set<U>

      • (source: ReadonlySet<T>): Set<U>
      • Parameters

        • source: ReadonlySet<T>

        Returns Set<U>

concat

  • concat<T>(sources: Iterable<ReadonlyArray<T>>): T[]
  • Combines the given collection-of-arrays as a single concatenated array.

    example

    Arrays.concat([[1, 2], [3, 4], [5]]) // [1, 2, 3, 4, 5] // or using pipe pipe([[1, 2], [3, 4], [5]], Arrays.concat) // [1, 2, 3, 4, 5]

    Type parameters

    • T

    Parameters

    • sources: Iterable<ReadonlyArray<T>>

      The input collection.

    Returns T[]

contains

  • contains<T>(source: ReadonlySet<T>, item: T): boolean
  • contains<T>(item: T): (source: ReadonlySet<T>) => boolean
  • Evaluates to true if the given item is in the source set.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • item: T

      The item to look for.

    Returns boolean

  • Evaluates to true if the given item is in the source set.

    Type parameters

    • T

    Parameters

    • item: T

      The item to look for.

    Returns (source: ReadonlySet<T>) => boolean

      • (source: ReadonlySet<T>): boolean
      • Parameters

        • source: ReadonlySet<T>

          The input collection.

        Returns boolean

containsKey

  • containsKey<Key, T>(source: ReadonlyMap<Key, T>, key: Key): boolean
  • containsKey<Key, T>(key: Key): (source: ReadonlyMap<Key, T>) => boolean
  • Evaluates to true if the given key is in the source map.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • key: Key

      The key to look for.

    Returns boolean

  • Evaluates to true if the given key is in the source map.

    Type parameters

    • Key

    • T

    Parameters

    • key: Key

      The key to look for.

    Returns (source: ReadonlyMap<Key, T>) => boolean

      • (source: ReadonlyMap<Key, T>): boolean
      • Parameters

        • source: ReadonlyMap<Key, T>

          The input collection.

        Returns boolean

count

  • count<T>(source: ReadonlyArray<T>): number
  • Returns the number of items in the array.

    example

    Arrays.count([1, 2, 3, 4, 5] // 5 // or using pipe pipe([1, 2, 3, 4, 5], Arrays.count) // 5

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    Returns number

distinct

  • distinct<T>(source: ReadonlyArray<T>): T[]
  • Returns an array that contains no duplicate entries according to the equality comparisons on the elements. If an element occurs multiple times in the sequence then the later occurrences are discarded.

    example

    Arrays.distinct(['amy', 'bob', 'bob', 'cat']) // ['amy', 'bob', 'cat'] // or using pipe pipe(['amy', 'bob', 'bob', 'cat'], Arrays.distinct) // ['amy', 'bob', 'cat']

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    Returns T[]

distinctBy

  • distinctBy<T, Key>(source: ReadonlyArray<T>, selector: (item: T, index: number) => Key): T[]
  • distinctBy<T, Key>(selector: (item: T, index: number) => Key): (source: ReadonlyArray<T>) => T[]
  • distinctBy<T, Key>(source: Iterable<T>, selector: (item: T, index: number) => Key): Iterable<T>
  • distinctBy<T, Key>(selector: (item: T, index: number) => Key): (source: Iterable<T>) => Iterable<T>
  • Returns an array that contains no duplicate entries according to the equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the sequence then the later occurrences are discarded.

    example

    pipe([ { name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'bob', id: 3 }, { name: 'cat', id: 3 } ], Arrays.distinctBy(x => x.name) ) // [{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'cat', id: 3 }] // or using pipe Arrays.distinctBy([ { name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'bob', id: 3 }, { name: 'cat', id: 3 } ], x => x.name ) // [{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'cat', id: 3 }]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T, index: number) => Key

      A function that transforms the array items into comparable keys.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns T[]

  • Returns an array that contains no duplicate entries according to the equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the sequence then the later occurrences are discarded.

    example

    pipe([ { name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'bob', id: 3 }, { name: 'cat', id: 3 } ], Arrays.distinctBy(x => x.name) ) // [{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'cat', id: 3 }] // or using pipe Arrays.distinctBy([ { name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'bob', id: 3 }, { name: 'cat', id: 3 } ], x => x.name ) // [{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }, { name: 'cat', id: 3 }]

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T, index: number) => Key

      A function that transforms the array items into comparable keys.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T[]

  • Returns a iterable that contains no duplicate entries according to the equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the sequence then the later occurrences are discarded.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T, index: number) => Key

      A function that transforms the collection items into comparable keys.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns Iterable<T>

  • Returns a iterable that contains no duplicate entries according to the equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the sequence then the later occurrences are discarded.

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T, index: number) => Key

      A function that transforms the collection items into comparable keys.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

every

  • every<T>(source: ReadonlyArray<T>, predicate: (item: T, index: number) => boolean): boolean
  • every<T>(predicate: (item: T, index: number) => boolean): (source: ReadonlyArray<T>) => boolean
  • every<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): boolean
  • every<T>(predicate: (item: T, index: number) => boolean): (source: Iterable<T>) => boolean
  • every<T>(source: ReadonlySet<T>, predicate: (item: T) => boolean): boolean
  • every<T>(predicate: (item: T) => boolean): (source: ReadonlySet<T>) => boolean
  • every<Key, T>(source: ReadonlyMap<Key, T>, predicate: (key: Key, value: T) => boolean): boolean
  • every<Key, T>(predicate: (key: Key, value: T) => boolean): (source: ReadonlyMap<Key, T>) => boolean
  • Tests if every element of the array satisfies the given predicate.

    example

    Arrays.every([1, 2], x => x === 1) // false // or using pipe pipe([1, 2], Arrays.every(x => x >= 1)) // true

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test against each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns boolean

  • Tests if every element of the array satisfies the given predicate.

    example

    Arrays.every([1, 2], x => x === 1) // false // or using pipe pipe([1, 2], Arrays.every(x => x >= 1)) // true

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test against each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: ReadonlyArray<T>) => boolean

      • (source: ReadonlyArray<T>): boolean
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns boolean

  • Tests if every element of the collection satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test against each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns boolean

  • Tests if every element of the collection satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test against each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: Iterable<T>) => boolean

      • (source: Iterable<T>): boolean
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns boolean

  • Tests if any element of the set satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • predicate: (item: T) => boolean

      A function to test each item of the input collection.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns boolean

  • Tests if any element of the set satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T) => boolean

      A function to test each item of the input collection.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns (source: ReadonlySet<T>) => boolean

      • (source: ReadonlySet<T>): boolean
      • Parameters

        • source: ReadonlySet<T>

          The input collection.

        Returns boolean

  • Tests if every element of the map satisfies the given predicate.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • predicate: (key: Key, value: T) => boolean

      A function to test each item of the input collection.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns boolean

  • Tests if every element of the map satisfies the given predicate.

    Type parameters

    • Key

    • T

    Parameters

    • predicate: (key: Key, value: T) => boolean

      A function to test each item of the input collection.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns (source: ReadonlyMap<Key, T>) => boolean

      • (source: ReadonlyMap<Key, T>): boolean
      • Parameters

        • source: ReadonlyMap<Key, T>

          The input collection.

        Returns boolean

exists

  • exists<T>(source: ReadonlyArray<T>, predicate: (item: T, index: number) => boolean): boolean
  • exists<T>(predicate: (item: T, index: number) => boolean): (source: ReadonlyArray<T>) => boolean
  • exists<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): boolean
  • exists<T>(predicate: (item: T, index: number) => boolean): (source: Iterable<T>) => boolean
  • exists<T>(source: ReadonlySet<T>, predicate: (item: T) => boolean): boolean
  • exists<T>(predicate: (item: T) => boolean): (source: ReadonlySet<T>) => boolean
  • exists<Key, T>(source: ReadonlyMap<Key, T>, predicate: (key: Key, value: T) => boolean): boolean
  • exists<Key, T>(predicate: (key: Key, value: T) => boolean): (source: ReadonlyMap<Key, T>) => boolean
  • Tests if any element of the array satisfies the given predicate.

    example

    Arrays.exists([1, 2], x => x === 1) // true // or using pipe pipe([1, 2], Arrays.exists(x => x === 1)) // true

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns boolean

  • Tests if any element of the array satisfies the given predicate.

    example

    Arrays.exists([1, 2], x => x === 1) // true // or using pipe pipe([1, 2], Arrays.exists(x => x === 1)) // true

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: ReadonlyArray<T>) => boolean

      • (source: ReadonlyArray<T>): boolean
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns boolean

  • Tests if any element of the collection satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns boolean

  • Tests if any element of the collection satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test each item of the input collection.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: Iterable<T>) => boolean

      • (source: Iterable<T>): boolean
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns boolean

  • Tests if any element of the set satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • predicate: (item: T) => boolean

      A function to test each item of the input collection.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns boolean

  • Tests if any element of the set satisfies the given predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T) => boolean

      A function to test each item of the input collection.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns (source: ReadonlySet<T>) => boolean

      • (source: ReadonlySet<T>): boolean
      • Parameters

        • source: ReadonlySet<T>

          The input collection.

        Returns boolean

  • Tests if any element of the map satisfies the given predicate.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • predicate: (key: Key, value: T) => boolean

      A function to test each item of the input collection.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns boolean

  • Tests if any element of the map satisfies the given predicate.

    Type parameters

    • Key

    • T

    Parameters

    • predicate: (key: Key, value: T) => boolean

      A function to test each item of the input collection.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns (source: ReadonlyMap<Key, T>) => boolean

      • (source: ReadonlyMap<Key, T>): boolean
      • Parameters

        • source: ReadonlyMap<Key, T>

          The input collection.

        Returns boolean

filter

  • filter<T>(source: ReadonlyArray<T>, predicate: (item: T, index: number) => boolean): T[]
  • filter<T>(predicate: (item: T, index: number) => boolean): (source: ReadonlyArray<T>) => T[]
  • filter<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): Iterable<T>
  • filter<T>(predicate: (item: T, index: number) => boolean): (source: Iterable<T>) => Iterable<T>
  • filter<T>(source: ReadonlySet<T>, predicate: (item: T) => boolean): Set<T>
  • filter<T>(predicate: (item: T) => boolean): (source: ReadonlySet<T>) => Set<T>
  • filter<Key, T>(source: ReadonlyMap<Key, T>, predicate: (key: Key, value: T) => boolean): Map<Key, T>
  • filter<Key, T>(predicate: (key: Key, value: T) => boolean): (source: ReadonlyMap<Key, T>) => Map<Key, T>
  • Returns a new array containing only the elements of the collection for which the given predicate returns true.

    example

    Arrays.filter([1, 2, 3, 4], x => x % 2 === 0) // [2, 4] // or using pipe pipe([1, 2, 3, 4], Arrays.filter(x => x % 2 === 0)) // [2, 4]

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether each item in the input collection should be included in the output.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns T[]

  • Returns a new array containing only the elements of the collection for which the given predicate returns true.

    example

    Arrays.filter([1, 2, 3, 4], x => x % 2 === 0) // [2, 4] // or using pipe pipe([1, 2, 3, 4], Arrays.filter(x => x % 2 === 0)) // [2, 4]

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether each item in the input collection should be included in the output.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

        Returns T[]

  • Returns a new iterable containing only the elements of the collection for which the given predicate returns true.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether each item in the input collection should be included in the output.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns Iterable<T>

  • Returns a new iterable containing only the elements of the collection for which the given predicate returns true.

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether each item in the input collection should be included in the output.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

        Returns Iterable<T>

  • Returns a new set containing only the elements of the source set for which the given predicate returns true.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • predicate: (item: T) => boolean

      A function to test whether each item in the input set should be included in the output set.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns Set<T>

  • Returns a new set containing only the elements of the source set for which the given predicate returns true.

    Type parameters

    • T

    Parameters

    • predicate: (item: T) => boolean

      A function to test whether each item in the input set should be included in the output set.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns (source: ReadonlySet<T>) => Set<T>

      • (source: ReadonlySet<T>): Set<T>
      • Parameters

        • source: ReadonlySet<T>

        Returns Set<T>

  • Returns a new map containing only the elements of the map for which the given predicate returns true.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • predicate: (key: Key, value: T) => boolean

      A function to test whether each item in the input map should be included in the output map.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns Map<Key, T>

  • Returns a new map containing only the elements of the map for which the given predicate returns true.

    Type parameters

    • Key

    • T

    Parameters

    • predicate: (key: Key, value: T) => boolean

      A function to test whether each item in the input map should be included in the output map.

        • (key: Key, value: T): boolean
        • Parameters

          • key: Key
          • value: T

          Returns boolean

    Returns (source: ReadonlyMap<Key, T>) => Map<Key, T>

      • (source: ReadonlyMap<Key, T>): Map<Key, T>
      • Parameters

        • source: ReadonlyMap<Key, T>

        Returns Map<Key, T>

find

  • find<T>(source: ReadonlyArray<T>, predicate: (item: T, index: number) => boolean): T | undefined
  • find<T>(predicate: (item: T, index: number) => boolean): (source: ReadonlyArray<T>) => T | undefined
  • find<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): T | undefined
  • find<T>(predicate: (item: T, index: number) => boolean): (source: Iterable<T>) => T | undefined
  • find<T>(source: ReadonlySet<T>, predicate: (item: T) => boolean): T | undefined
  • find<T>(predicate: (item: T) => boolean): (source: ReadonlySet<T>) => T | undefined
  • find<Key, T>(source: ReadonlyMap<Key, T>, key: Key): T | undefined
  • find<Key, T>(key: Key): (source: ReadonlyMap<Key, T>) => T | undefined
  • Returns the first element for which the given function returns true, otherwise undefined.

    example

    Arrays.find([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], x => x.name === 'bob') // { name: 'bob', id: 2 } // or using pipe pipe([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], Arrays.find(x => x.name === 'bob')) // { name: 'bob', id: 2 }

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns T | undefined

  • Returns the first element for which the given function returns true, otherwise undefined.

    example

    Arrays.find([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], x => x.name === 'bob') // { name: 'bob', id: 2 } // or using pipe pipe([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], Arrays.find(x => x.name === 'bob')) // { name: 'bob', id: 2 }

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: ReadonlyArray<T>) => T | undefined

      • (source: ReadonlyArray<T>): T | undefined
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T | undefined

  • Returns the first element for which the given function returns true, otherwise undefined.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns T | undefined

  • Returns the first element for which the given function returns true, otherwise undefined.

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: Iterable<T>) => T | undefined

      • (source: Iterable<T>): T | undefined
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns T | undefined

  • Returns the first element for which the given function returns true, otherwise undefined.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • predicate: (item: T) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns T | undefined

  • Returns the first element for which the given function returns true, otherwise undefined.

    Type parameters

    • T

    Parameters

    • predicate: (item: T) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns (source: ReadonlySet<T>) => T | undefined

      • (source: ReadonlySet<T>): T | undefined
      • Parameters

        • source: ReadonlySet<T>

          The input collection.

        Returns T | undefined

  • Returns the value for the given key, or undefined if not found.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • key: Key

      The key to lookup in the map.

    Returns T | undefined

  • Returns the value for the given key, or undefined if not found.

    Type parameters

    • Key

    • T

    Parameters

    • key: Key

      The key to lookup in the map.

    Returns (source: ReadonlyMap<Key, T>) => T | undefined

      • (source: ReadonlyMap<Key, T>): T | undefined
      • Parameters

        • source: ReadonlyMap<Key, T>

          The input collection.

        Returns T | undefined

get

  • get<T>(source: ReadonlyArray<T>, predicate: (item: T, index: number) => boolean): T
  • get<T>(predicate: (item: T, index: number) => boolean): (source: ReadonlyArray<T>) => T
  • get<T>(source: Iterable<T>, predicate: (item: T, index: number) => boolean): T
  • get<T>(predicate: (item: T, index: number) => boolean): (source: Iterable<T>) => T
  • get<T>(source: ReadonlySet<T>, predicate: (item: T) => boolean): T
  • get<T>(predicate: (item: T) => boolean): (source: ReadonlySet<T>) => T
  • get<Key, T>(source: ReadonlyMap<Key, T>, key: Key): T
  • get<Key, T>(key: Key): (source: ReadonlyMap<Key, T>) => T
  • Returns the first element for which the given function returns true or throws if not found. If you don't want exceptions, use find instead.

    throws

    If no item is found matching the criteria of the predicate.

    example

    Arrays.get([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], x => x.name === 'bob') // { name: 'bob', id: 2 } // or using pipe pipe([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], Arrays.get(x => x.name === 'bob')) // { name: 'bob', id: 2 }

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns T

  • Returns the first element for which the given function returns true. If you don't want exceptions, use find instead.

    throws

    If no item is found matching the criteria of the predicate.

    example

    Arrays.get([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], x => x.name === 'bob') // { name: 'bob', id: 2 } // or using pipe pipe([{ name: 'amy', id: 1 }, { name: 'bob', id: 2 }], Arrays.get(x => x.name === 'bob')) // { name: 'bob', id: 2 }

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: ReadonlyArray<T>) => T

      • (source: ReadonlyArray<T>): T
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T

  • Returns the first element for which the given function returns true.

    throws

    If no item is found matching the criteria of the predicate.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns T

  • Returns the first element for which the given function returns true.

    throws

    If no item is found matching the criteria of the predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T, index: number) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T, index: number): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns (source: Iterable<T>) => T

      • (source: Iterable<T>): T
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns T

  • Returns the first element for which the given function returns true.

    throws

    If no item is found matching the criteria of the predicate.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • predicate: (item: T) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns T

  • Returns the first element for which the given function returns true.

    throws

    If no item is found matching the criteria of the predicate.

    Type parameters

    • T

    Parameters

    • predicate: (item: T) => boolean

      A function to test whether an item in the collection should be returned.

        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns (source: ReadonlySet<T>) => T

      • (source: ReadonlySet<T>): T
      • Parameters

        • source: ReadonlySet<T>

          The input collection.

        Returns T

  • Returns the value for the given key.

    throws

    If the key does not exist in the source collection.

    Type parameters

    • Key

    • T

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • key: Key

      The key to lookup in the map.

    Returns T

  • Returns the value for the given key.

    throws

    If the key does not exist in the source collection.

    Type parameters

    • Key

    • T

    Parameters

    • key: Key

      The key to lookup in the map.

    Returns (source: ReadonlyMap<Key, T>) => T

      • (source: ReadonlyMap<Key, T>): T
      • Parameters

        • source: ReadonlyMap<Key, T>

          The input collection.

        Returns T

groupBy

  • groupBy<T, Key>(source: ReadonlyArray<T>, selector: (item: T, index: number) => Key): [Key, T[]][]
  • groupBy<T, Key>(selector: (item: T, index: number) => Key): (source: ReadonlyArray<T>) => [Key, T[]][]
  • groupBy<T, Key>(source: Iterable<T>, selector: (item: T, index: number) => Key): Iterable<[Key, Iterable<T>]>
  • groupBy<T, Key>(selector: (item: T, index: number) => Key): (source: Iterable<T>) => Iterable<[Key, ReadonlyArray<T>]>
  • Applies a key-generating function to each element of an array and yields an array of unique keys and an array of all elements that have each key.

    example

    Arrays.groupBy( [{ name: 'amy', age: 1 }, { name: 'bob', age: 2 }, { name: 'cat', age: 2 }], x => x.age ) // [[1, [{ name: 'amy', age: 1 }]], [2, [{ name: 'bob', age: 2 }, { name: 'cat', age: 2 }]]] // or using pipe pipe( [{ name: 'amy', age: 1 }, { name: 'bob', age: 2 }, { name: 'cat', age: 2 }], Arrays.groupBy(x => x.age) ) // [[1, [{ name: 'amy', age: 1 }]], [2, [{ name: 'bob', age: 2 }, { name: 'cat', age: 2 }]]]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T, index: number) => Key

      A function that transforms an element of the collection into a comparable key.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns [Key, T[]][]

  • Applies a key-generating function to each element of an array and yields an array of unique keys and an array of all elements that have each key.

    example

    Arrays.groupBy( [{ name: 'amy', age: 1 }, { name: 'bob', age: 2 }, { name: 'cat', age: 2 }], x => x.age ) // [[1, [{ name: 'amy', age: 1 }]], [2, [{ name: 'bob', age: 2 }, { name: 'cat', age: 2 }]]] // or using pipe pipe( [{ name: 'amy', age: 1 }, { name: 'bob', age: 2 }, { name: 'cat', age: 2 }], Arrays.groupBy(x => x.age) ) // [[1, [{ name: 'amy', age: 1 }]], [2, [{ name: 'bob', age: 2 }, { name: 'cat', age: 2 }]]]

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T, index: number) => Key

      A function that transforms an element of the collection into a comparable key.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns (source: ReadonlyArray<T>) => [Key, T[]][]

      • (source: ReadonlyArray<T>): [Key, T[]][]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns [Key, T[]][]

  • Applies a key-generating function to each element of a collection and yields a iterable of unique keys and an array of all elements that have each key.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T, index: number) => Key

      A function that transforms an element of the collection into a comparable key.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns Iterable<[Key, Iterable<T>]>

  • Applies a key-generating function to each element of a collection and yields a iterable of unique keys and an array of all elements that have each key.

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T, index: number) => Key

      A function that transforms an element of the collection into a comparable key.

        • (item: T, index: number): Key
        • Parameters

          • item: T
          • index: number

          Returns Key

    Returns (source: Iterable<T>) => Iterable<[Key, ReadonlyArray<T>]>

      • (source: Iterable<T>): Iterable<[Key, ReadonlyArray<T>]>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<[Key, ReadonlyArray<T>]>

init

  • init(options: InitRange | InitCount): number[]
  • init(count: number): number[]
  • init<T>(options: InitRange | InitCount, initializer: (index: number) => T): T[]
  • init<T>(count: number, initializer: (index: number) => T): T[]
  • Generates a new array containing the specified number sequence.

    throws

    When the options would result in an iterable that would not complete. If this is the desired behaviour, use initInfinite.

    example

    Arrays.init(3) // [0, 1, 2] Arrays.init(3, x => x * x) // [0, 1, 4] Arrays.init({ from: 1, to: 3 }) // [1, 2, 3] Arrays.init({ from: 1, to: 2, increment: 0.5 }) // [1, 1.5, 2] Arrays.init({ from: 1, to: -1 }) // [1, 0, -1] Arrays.init({ start: 3, count: 3 }) // [3, 4, 5] Arrays.init({ count: 3, increment: 2 }) // [0, 2, 4] Arrays.init({ start: 3, count: 5, increment: 2 }) // [3, 5, 7, 9, 11]

    Parameters

    Returns number[]

  • Generates a new array containing the specified number sequence.

    throws

    When the options would result in an iterable that would not complete. If this is the desired behaviour, use initInfinite.

    example

    Arrays.init(3) // [0, 1, 2] Arrays.init(3, x => x * x) // [0, 1, 4] Arrays.init({ from: 1, to: 3 }) // [1, 2, 3] Arrays.init({ from: 1, to: 2, increment: 0.5 }) // [1, 1.5, 2] Arrays.init({ from: 1, to: -1 }) // [1, 0, -1] Arrays.init({ start: 3, count: 3 }) // [3, 4, 5] Arrays.init({ count: 3, increment: 2 }) // [0, 2, 4] Arrays.init({ start: 3, count: 5, increment: 2 }) // [3, 5, 7, 9, 11]

    Parameters

    • count: number

      The number of sequential numbers to generate.

    Returns number[]

  • Generates a new array containing elements generated by the initializer funciton.

    throws

    When the options would result in an array of infinite size.

    example

    Arrays.init(3) // [0, 1, 2] Arrays.init(3, x => x * x) // [0, 1, 4] Arrays.init({ from: 1, to: 3 }) // [1, 2, 3] Arrays.init({ from: 1, to: 2, increment: 0.5 }) // [1, 1.5, 2] Arrays.init({ from: 1, to: -1 }) // [1, 0, -1] Arrays.init({ start: 3, count: 3 }) // [3, 4, 5] Arrays.init({ count: 3, increment: 2 }) // [0, 2, 4] Arrays.init({ start: 3, count: 5, increment: 2 }) // [3, 5, 7, 9, 11]

    Type parameters

    • T

    Parameters

    • options: InitRange | InitCount

      The sequence of numbers to generate.

    • initializer: (index: number) => T

      A function that generates an item in the array from a given number.

        • (index: number): T
        • Parameters

          • index: number

          Returns T

    Returns T[]

  • Generates a new array containing elements generated by the initializer funciton.

    throws

    When the options would result in an array of infinite size.

    example

    Arrays.init(3) // [0, 1, 2] Arrays.init(3, x => x * x) // [0, 1, 4] Arrays.init({ from: 1, to: 3 }) // [1, 2, 3] Arrays.init({ from: 1, to: 2, increment: 0.5 }) // [1, 1.5, 2] Arrays.init({ from: 1, to: -1 }) // [1, 0, -1] Arrays.init({ start: 3, count: 3 }) // [3, 4, 5] Arrays.init({ count: 3, increment: 2 }) // [0, 2, 4] Arrays.init({ start: 3, count: 5, increment: 2 }) // [3, 5, 7, 9, 11]

    Type parameters

    • T

    Parameters

    • count: number

      The number of sequential numbers to generate.

    • initializer: (index: number) => T

      A function that generates an item in the array from a given number.

        • (index: number): T
        • Parameters

          • index: number

          Returns T

    Returns T[]

initInfinite

  • initInfinite(options?: undefined | { increment?: undefined | number; start?: undefined | number }): Iterable<number>
  • Generates a new iterable which, when iterated, will return the specified number sequence.

    Parameters

    • Optional options: undefined | { increment?: undefined | number; start?: undefined | number }

      The sequence of numbers to generate.

    Returns Iterable<number>

length

  • length<T>(source: ReadonlyArray<T>): number
  • Returns the number of items in the array.

    example

    Arrays.length([1, 2, 3, 4, 5] // 5 // or using pipe pipe([1, 2, 3, 4, 5], Arrays.length) // 5

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    Returns number

map

  • map<T, U>(source: ReadonlyArray<T>, mapping: (item: T, index: number) => U): U[]
  • map<T, U>(mapping: (item: T, index: number) => U): (source: ReadonlyArray<T>) => U[]
  • map<T, U>(source: Iterable<T>, mapping: (item: T, index: number) => U): Iterable<U>
  • map<T, U>(mapping: (item: T, index: number) => U): (source: Iterable<T>) => Iterable<U>
  • map<T, U>(source: ReadonlySet<T>, mapping: (item: T) => U): Set<U>
  • map<T, U>(mapping: (item: T) => U): (source: ReadonlySet<T>) => Set<U>
  • map<Key, T, U>(source: ReadonlyMap<Key, T>, mapping: (key: Key, value: T) => U): Map<Key, U>
  • map<Key, T, U>(mapping: (key: Key, value: T) => U): (source: ReadonlyMap<Key, T>) => Map<Key, U>
  • Creates a new array whose elements are the results of applying the specified mapping to each of the elements of the source collection.

    example

    Arrays.map([1, 2], x => x * 2) // [2, 4] // or using pipe pipe([1, 2], Arrays.map(x => x * 2)) // [2, 4]

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • mapping: (item: T, index: number) => U

      A function to transform items from the input collection.

        • (item: T, index: number): U
        • Parameters

          • item: T
          • index: number

          Returns U

    Returns U[]

  • Creates a new array whose elements are the results of applying the specified mapping to each of the elements of the source collection.

    example

    Arrays.map([1, 2], x => x * 2) // [2, 4] // or using pipe pipe([1, 2], Arrays.map(x => x * 2)) // [2, 4]

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T, index: number) => U

      A function to transform items from the input collection.

        • (item: T, index: number): U
        • Parameters

          • item: T
          • index: number

          Returns U

    Returns (source: ReadonlyArray<T>) => U[]

      • (source: ReadonlyArray<T>): U[]
      • Parameters

        • source: ReadonlyArray<T>

        Returns U[]

  • Creates a new iterable whose elements are the results of applying the specified mapping to each of the elements of the source collection.

    Type parameters

    • T

    • U

    Parameters

    • source: Iterable<T>

      The input collection.

    • mapping: (item: T, index: number) => U

      A function to transform items from the input collection.

        • (item: T, index: number): U
        • Parameters

          • item: T
          • index: number

          Returns U

    Returns Iterable<U>

  • Creates a new iterable whose elements are the results of applying the specified mapping to each of the elements of the source collection.

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T, index: number) => U

      A function to transform items from the input collection.

        • (item: T, index: number): U
        • Parameters

          • item: T
          • index: number

          Returns U

    Returns (source: Iterable<T>) => Iterable<U>

      • (source: Iterable<T>): Iterable<U>
      • Parameters

        • source: Iterable<T>

        Returns Iterable<U>

  • Creates a new set whose elements are the results of applying the specified mapping to each of the elements of the source set. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • source: ReadonlySet<T>

      The input collection.

    • mapping: (item: T) => U

      A function to transform items from the input collection.

        • (item: T): U
        • Parameters

          • item: T

          Returns U

    Returns Set<U>

  • Creates a new set whose elements are the results of applying the specified mapping to each of the elements of the source set. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    • U

    Parameters

    • mapping: (item: T) => U

      A function to transform items from the input collection.

        • (item: T): U
        • Parameters

          • item: T

          Returns U

    Returns (source: ReadonlySet<T>) => Set<U>

      • (source: ReadonlySet<T>): Set<U>
      • Parameters

        • source: ReadonlySet<T>

        Returns Set<U>

  • Creates a new map whose values are the results of applying the specified mapping to each of the values of the source map.

    Type parameters

    • Key

    • T

    • U

    Parameters

    • source: ReadonlyMap<Key, T>

      The input collection.

    • mapping: (key: Key, value: T) => U

      A function to transform entries from the input collection into new values.

        • (key: Key, value: T): U
        • Parameters

          • key: Key
          • value: T

          Returns U

    Returns Map<Key, U>

  • Creates a new map whose values are the results of applying the specified mapping to each of the values of the source map.

    Type parameters

    • Key

    • T

    • U

    Parameters

    • mapping: (key: Key, value: T) => U

      A function to transform entries from the input collection into new values.

        • (key: Key, value: T): U
        • Parameters

          • key: Key
          • value: T

          Returns U

    Returns (source: ReadonlyMap<Key, T>) => Map<Key, U>

      • (source: ReadonlyMap<Key, T>): Map<Key, U>
      • Parameters

        • source: ReadonlyMap<Key, T>

        Returns Map<Key, U>

max

  • max(source: ReadonlyArray<number>): number
  • Returns the maximum of the values in the collection.

    throws

    If the collection is empty.

    example

    Arrays.max([21, 2, 18]) // 21 // or using pipe pipe([21, 2, 18], Arrays.max) // 21

    Parameters

    • source: ReadonlyArray<number>

      The input collection.

    Returns number

maxBy

  • maxBy<T>(source: ReadonlyArray<T>, selector: (item: T) => number): number
  • maxBy<T>(selector: (item: T) => number): (source: ReadonlyArray<T>) => number
  • maxBy<T>(source: Iterable<T>, selector: (item: T) => number): number
  • maxBy<T>(selector: (item: T) => number): (source: Iterable<T>) => number
  • Returns the maximum of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.maxBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 21

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.maxBy(x => x.age) ) // 21

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the maximum of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.maxBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 21

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.maxBy(x => x.age) ) // 21

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: ReadonlyArray<T>) => number

      • (source: ReadonlyArray<T>): number
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns number

  • Returns the maximum of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the maximum of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: Iterable<T>) => number

      • (source: Iterable<T>): number
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns number

mean

  • mean(source: ReadonlyArray<number>): number
  • Returns the mean (average) of the values in the collection.

    throws

    If the collection is empty.

    example

    Arrays.mean([21, 2, 18, 39]) // 20 // or using pipe pipe([21, 2, 18, 39], Arrays.mean) // 20

    Parameters

    • source: ReadonlyArray<number>

      The input collection.

    Returns number

meanBy

  • meanBy<T>(source: ReadonlyArray<T>, selector: (item: T) => number): number
  • meanBy<T>(selector: (item: T) => number): (source: ReadonlyArray<T>) => number
  • meanBy<T>(source: Iterable<T>, selector: (item: T) => number): number
  • meanBy<T>(selector: (item: T) => number): (source: Iterable<T>) => number
  • Returns the mean (average) of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.meanBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 3 }, { name: 'cat', age: 18 }], x => x.age ) // 14

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 3 }, { name: 'cat', age: 18 }], Arrays.meanBy(x => x.age) ) // 14

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the mean (average) of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.meanBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 3 }, { name: 'cat', age: 18 }], x => x.age ) // 14

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 3 }, { name: 'cat', age: 18 }], Arrays.meanBy(x => x.age) ) // 14

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: ReadonlyArray<T>) => number

      • (source: ReadonlyArray<T>): number
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns number

  • Returns the mean (average) of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the mean (average) of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: Iterable<T>) => number

      • (source: Iterable<T>): number
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns number

min

  • min(source: ReadonlyArray<number>): number
  • Returns the minimum of the values in the collection.

    throws

    If the collection is empty.

    example

    Arrays.min([21, 2, 18]) // 2 // or using pipe pipe([21, 2, 18], Arrays.min) // 2

    Parameters

    • source: ReadonlyArray<number>

      The input collection.

    Returns number

minBy

  • minBy<T>(source: ReadonlyArray<T>, selector: (item: T) => number): number
  • minBy<T>(selector: (item: T) => number): (source: ReadonlyArray<T>) => number
  • minBy<T>(source: Iterable<T>, selector: (item: T) => number): number
  • minBy<T>(selector: (item: T) => number): (source: Iterable<T>) => number
  • Returns the minimum of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.minBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 2

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.minBy(x => x.age) ) // 2

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the minimum of the values returned by the selector for each element in the array.

    throws

    If the collection is empty.

    example

    Arrays.minBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 2

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.minBy(x => x.age) ) // 2

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: ReadonlyArray<T>) => number

      • (source: ReadonlyArray<T>): number
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns number

  • Returns the minimum of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the minimum of the values returned by the selector for each element in the collection.

    throws

    If the collection is empty.

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a comparable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: Iterable<T>) => number

      • (source: Iterable<T>): number
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns number

ofArray

  • ofArray<T>(source: ReadonlyArray<T>): Set<T>
  • Creates a set from the source array object. NOTE: Duplicate items will be ignored.

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      An array of tuples to convert to a map.

    Returns Set<T>

ofIterable

  • ofIterable<T>(source: Iterable<T>): T[]
  • Creates an array from the source iterable object.

    example

    Arrays.ofIterable((function*() { yield 1 yield 2 })()) // [1, 2]

    // or using pipe pipe( (function*() { yield 1 yield 2 })(), Arrays.ofIterable ) // [1, 2]

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      An iterable objext to convert to a set.

    Returns T[]

ofSet

  • ofSet<T>(source: ReadonlySet<T>): Map<T, T>
  • Creates a map from the source set object.

    Type parameters

    • T

    Parameters

    • source: ReadonlySet<T>

      A set objext to convert to a map.

    Returns Map<T, T>

pairwise

  • pairwise<T>(source: ReadonlyArray<T>): [T, T][]
  • Returns an array of each element in the input collection and its predecessor, with the exception of the first element which is only returned as the predecessor of the second element.

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection

    Returns [T, T][]

pipe

  • pipe<T>(input: T): Pipe<T>
  • pipe<Input, A>(input: Input, a: (value: Input) => A): A
  • pipe<Input, A, B>(input: Input, a: (value: Input) => A, b: (value: A) => B): B
  • pipe<Input, A, B, C>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C): C
  • pipe<Input, A, B, C, D>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D): D
  • pipe<Input, A, B, C, D, E>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E): E
  • pipe<Input, A, B, C, D, E, F>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F): F
  • pipe<Input, A, B, C, D, E, F, G>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G): G
  • pipe<Input, A, B, C, D, E, F, G, H>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H): H
  • pipe<Input, A, B, C, D, E, F, G, H, I>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I): I
  • pipe<Input, A, B, C, D, E, F, G, H, I, J>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J): J
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K): K
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L): L
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M): M
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N): N
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O): O
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P): P
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q): Q
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R): R
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S): S
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T): T
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U): U
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U, v: (value: U) => V): V
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U, v: (value: U) => V, w: (value: V) => W): W
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U, v: (value: U) => V, w: (value: V) => W, x: (value: W) => X): X
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U, v: (value: U) => V, w: (value: V) => W, x: (value: W) => X, y: (value: X) => Y): Y
  • pipe<Input, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z>(input: Input, a: (value: Input) => A, b: (value: A) => B, c: (value: B) => C, d: (value: C) => D, e: (value: D) => E, f: (value: E) => F, g: (value: F) => G, h: (value: G) => H, i: (value: H) => I, j: (value: I) => J, k: (value: J) => K, l: (value: K) => L, m: (value: L) => M, n: (value: M) => N, o: (value: N) => O, p: (value: O) => P, q: (value: P) => Q, r: (value: Q) => R, s: (value: R) => S, t: (value: S) => T, u: (value: T) => U, v: (value: U) => V, w: (value: V) => W, x: (value: W) => X, y: (value: X) => Y, z: (value: Y) => Z): Z
  • Starts a new pipe with the given input as an initial value. This returns a pipe object to use for executing a series of functions. To get the final result, use the result property.

    Type parameters

    • T

    Parameters

    • input: T

      The initial value to start the pipe.

    Returns Pipe<T>

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    Returns A

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    Returns B

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    Returns C

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    Returns D

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    Returns E

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    Returns F

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    Returns G

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    Returns H

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    Returns I

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    Returns J

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    Returns K

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    Returns L

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    Returns M

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    Returns N

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    Returns O

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    Returns P

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    Returns Q

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    Returns R

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    Returns S

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    Returns T

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    Returns U

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • v: (value: U) => V
        • (value: U): V
        • Parameters

          • value: U

          Returns V

    Returns V

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • v: (value: U) => V
        • (value: U): V
        • Parameters

          • value: U

          Returns V

    • w: (value: V) => W
        • (value: V): W
        • Parameters

          • value: V

          Returns W

    Returns W

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • v: (value: U) => V
        • (value: U): V
        • Parameters

          • value: U

          Returns V

    • w: (value: V) => W
        • (value: V): W
        • Parameters

          • value: V

          Returns W

    • x: (value: W) => X
        • (value: W): X
        • Parameters

          • value: W

          Returns X

    Returns X

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Y

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • v: (value: U) => V
        • (value: U): V
        • Parameters

          • value: U

          Returns V

    • w: (value: V) => W
        • (value: V): W
        • Parameters

          • value: V

          Returns W

    • x: (value: W) => X
        • (value: W): X
        • Parameters

          • value: W

          Returns X

    • y: (value: X) => Y
        • (value: X): Y
        • Parameters

          • value: X

          Returns Y

    Returns Y

    The result of the last function provided.

  • Calls each successive function with the result of the previous function.

    Type parameters

    • Input

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    • J

    • K

    • L

    • M

    • N

    • O

    • P

    • Q

    • R

    • S

    • T

    • U

    • V

    • W

    • X

    • Y

    • Z

    Parameters

    • input: Input

      The initial value to pass to the next function.

    • a: (value: Input) => A
        • (value: Input): A
        • Parameters

          • value: Input

          Returns A

    • b: (value: A) => B
        • (value: A): B
        • Parameters

          • value: A

          Returns B

    • c: (value: B) => C
        • (value: B): C
        • Parameters

          • value: B

          Returns C

    • d: (value: C) => D
        • (value: C): D
        • Parameters

          • value: C

          Returns D

    • e: (value: D) => E
        • (value: D): E
        • Parameters

          • value: D

          Returns E

    • f: (value: E) => F
        • (value: E): F
        • Parameters

          • value: E

          Returns F

    • g: (value: F) => G
        • (value: F): G
        • Parameters

          • value: F

          Returns G

    • h: (value: G) => H
        • (value: G): H
        • Parameters

          • value: G

          Returns H

    • i: (value: H) => I
        • (value: H): I
        • Parameters

          • value: H

          Returns I

    • j: (value: I) => J
        • (value: I): J
        • Parameters

          • value: I

          Returns J

    • k: (value: J) => K
        • (value: J): K
        • Parameters

          • value: J

          Returns K

    • l: (value: K) => L
        • (value: K): L
        • Parameters

          • value: K

          Returns L

    • m: (value: L) => M
        • (value: L): M
        • Parameters

          • value: L

          Returns M

    • n: (value: M) => N
        • (value: M): N
        • Parameters

          • value: M

          Returns N

    • o: (value: N) => O
        • (value: N): O
        • Parameters

          • value: N

          Returns O

    • p: (value: O) => P
        • (value: O): P
        • Parameters

          • value: O

          Returns P

    • q: (value: P) => Q
        • (value: P): Q
        • Parameters

          • value: P

          Returns Q

    • r: (value: Q) => R
        • (value: Q): R
        • Parameters

          • value: Q

          Returns R

    • s: (value: R) => S
        • (value: R): S
        • Parameters

          • value: R

          Returns S

    • t: (value: S) => T
        • (value: S): T
        • Parameters

          • value: S

          Returns T

    • u: (value: T) => U
        • (value: T): U
        • Parameters

          • value: T

          Returns U

    • v: (value: U) => V
        • (value: U): V
        • Parameters

          • value: U

          Returns V

    • w: (value: V) => W
        • (value: V): W
        • Parameters

          • value: V

          Returns W

    • x: (value: W) => X
        • (value: W): X
        • Parameters

          • value: W

          Returns X

    • y: (value: X) => Y
        • (value: X): Y
        • Parameters

          • value: X

          Returns Y

    • z: (value: Y) => Z
        • (value: Y): Z
        • Parameters

          • value: Y

          Returns Z

    Returns Z

    The result of the last function provided.

reverse

  • reverse<T>(source: ReadonlyArray<T>): T[]
  • Returns a new array with the order of elements reversed.

    example

    Arrays.reverse([8, 3, 5]) // [5, 3, 8] // or using pipe pipe([8, 3, 5], Arrays.reverse) // [5, 3, 8]

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    Returns T[]

skip

  • skip<T>(source: Iterable<T>, count: number): Iterable<T>
  • skip<T>(count: number): (source: Iterable<T>) => Iterable<T>
  • Returns the elements of the iterable after a specified count.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • count: number

      The number of items to skip.

    Returns Iterable<T>

  • Returns the elements of the iterable after a specified count.

    Type parameters

    • T

    Parameters

    • count: number

      The number of items to skip.

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

sort

  • sort<T, Key>(source: ReadonlyArray<T>, selector?: undefined | ((item: T) => Key)): T[]
  • sort<T, Key>(selector?: undefined | ((item: T) => Key)): (source: ReadonlyArray<T>) => T[]
  • sort<T, Key>(source: Iterable<T>, selector?: undefined | ((item: T) => Key)): Iterable<T>
  • sort<T, Key>(selector?: undefined | ((item: T) => Key)): (source: Iterable<T>) => Iterable<T>
  • Returns a new array ordered by the selected key. If no selector is specified, the elements will be compared directly.

    example

    Arrays.sort([21, 2, 18]) // [2, 18, 21]

    // with selector Arrays.sort( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sort(x => x.age) ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns T[]

  • Returns a new array ordered by the selected key. If no selector is specified, the elements will be compared directly.

    example

    Arrays.sort([21, 2, 18]) // [2, 18, 21]

    // with selector Arrays.sort( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sort(x => x.age) ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    Type parameters

    • T

    • Key

    Parameters

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T[]

  • Yields an iterable ordered by the selected key. If no selector is specified, the elements will be compared directly.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns Iterable<T>

  • Yields an iterable ordered by the selected key. If no selector is specified, the elements will be compared directly.

    Type parameters

    • T

    • Key

    Parameters

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

sortBy

  • sortBy<T, Key>(source: ReadonlyArray<T>, selector: (item: T) => Key): T[]
  • sortBy<T, Key>(selector: (item: T) => Key): (source: ReadonlyArray<T>) => T[]
  • sortBy<T, Key>(selector: (item: T) => Key): (source: Iterable<T>) => Iterable<T>
  • sortBy<T, Key>(source: Iterable<T>, selector: (item: T) => Key): Iterable<T>
  • Applies a key-generating function to each element of the array and returns a new array ordered by the keys.

    example

    Arrays.sortBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortBy(x => x.age) ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns T[]

  • Applies a key-generating function to each element of the array and returns a new array ordered by the keys.

    example

    Arrays.sortBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortBy(x => x.age) ) // [{ name: 'bob', age: 2 }, { name: 'cat', age: 18 }, { name: 'amy', age: 21 }]

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T[]

  • Applies a key-generating function to each element of the collection and yields an iterable ordered by keys.

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

  • Applies a key-generating function to each element of the collection and yields an iterable ordered by keys.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns Iterable<T>

sortByDescending

  • sortByDescending<T, Key>(source: ReadonlyArray<T>, selector: (item: T) => Key): T[]
  • sortByDescending<T, Key>(selector: (item: T) => Key): (source: ReadonlyArray<T>) => T[]
  • sortByDescending<T, Key>(source: Iterable<T>, selector: (item: T) => Key): Iterable<T>
  • sortByDescending<T, Key>(selector: (item: T) => Key): (source: Iterable<T>) => Iterable<T>
  • Applies a key-generating function to each element of the array and returns a new array ordered by the keys, descending.

    example

    // with selector Arrays.sortByDescending( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortByDescending(x => x.age) ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns T[]

  • Applies a key-generating function to each element of the array and returns a new array ordered by the keys, descending.

    example

    // with selector Arrays.sortByDescending( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortByDescending(x => x.age) ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T[]

  • Applies a key-generating function to each element of the collection and yields an iterable ordered by keys, descending.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns Iterable<T>

  • Applies a key-generating function to each element of the collection and yields an iterable ordered by keys, descending.

    Type parameters

    • T

    • Key

    Parameters

    • selector: (item: T) => Key

      A function to transform items of the input sequence into comparable keys.

        • (item: T): Key
        • Parameters

          • item: T

          Returns Key

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

sortDescending

  • sortDescending<T, Key>(source: ReadonlyArray<T>, selector?: undefined | ((item: T) => Key)): T[]
  • sortDescending<T, Key>(selector?: undefined | ((item: T) => Key)): (source: ReadonlyArray<T>) => T[]
  • sortDescending<T, Key>(source: Iterable<T>, selector?: undefined | ((item: T) => Key)): Iterable<T>
  • sortDescending<T, Key>(selector?: undefined | ((item: T) => Key)): (source: Iterable<T>) => Iterable<T>
  • Yields an iterable ordered by the selected key descending. If no selector is specified, the elements will be compared directly.

    example

    Arrays.sortDescending([21, 2, 18]) // [21, 18, 2]

    // with selector Arrays.sortDescending( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortDescending(x => x.age) ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    Type parameters

    • T

    • Key

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns T[]

  • Yields an iterable ordered by the selected key, descending. If no selector is specified, the elements will be compared directly.

    example

    Arrays.sortDescending([21, 2, 18]) // [21, 18, 2]

    // with selector Arrays.sortDescending( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    // with piping pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sortDescending(x => x.age) ) // [{ name: 'amy', age: 21 }, { name: 'cat', age: 18 }, { name: 'bob', age: 2 }]

    Type parameters

    • T

    • Key

    Parameters

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns (source: ReadonlyArray<T>) => T[]

      • (source: ReadonlyArray<T>): T[]
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns T[]

  • Yields an iterable ordered by the selected key descending. If no selector is specified, the elements will be compared directly.

    Type parameters

    • T

    • Key

    Parameters

    • source: Iterable<T>

      The input collection.

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns Iterable<T>

  • Yields an iterable ordered by the selected key, descending. If no selector is specified, the elements will be compared directly.

    Type parameters

    • T

    • Key

    Parameters

    • Optional selector: undefined | ((item: T) => Key)

      An optional function to transform items of the input sequence into comparable keys.

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

sum

  • sum(source: ReadonlyArray<number>): number
  • Returns the sum of the values in the collection.

    example

    Arrays.sum([21, 2, 18]) // 41 // or using pipe pipe([21, 2, 18], Arrays.sum) // 41

    Parameters

    • source: ReadonlyArray<number>

      The input collection.

    Returns number

sumBy

  • sumBy<T>(source: ReadonlyArray<T>, selector: (item: T) => number): number
  • sumBy<T>(selector: (item: T) => number): (source: ReadonlyArray<T>) => number
  • sumBy<T>(source: Iterable<T>, selector: (item: T) => number): number
  • sumBy<T>(selector: (item: T) => number): (source: Iterable<T>) => number
  • Returns the sum of the values returned by the selector for each element in the array.

    example

    Arrays.sumBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 41

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sumBy(x => x.age) ) // 41

    Type parameters

    • T

    Parameters

    • source: ReadonlyArray<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the sum of the values returned by the selector for each element in the array.

    example

    Arrays.sumBy( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], x => x.age ) // 41

    // or using pipe pipe( [{ name: 'amy', age: 21 }, { name: 'bob', age: 2 }, { name: 'cat', age: 18 }], Arrays.sumBy(x => x.age) ) // 41

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: ReadonlyArray<T>) => number

      • (source: ReadonlyArray<T>): number
      • Parameters

        • source: ReadonlyArray<T>

          The input collection.

        Returns number

  • Returns the sum of the values returned by the selector for each element in the collection.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns number

  • Returns the sum of the values returned by the selector for each element in the collection.

    Type parameters

    • T

    Parameters

    • selector: (item: T) => number

      A function to transform each element into a summable value.

        • (item: T): number
        • Parameters

          • item: T

          Returns number

    Returns (source: Iterable<T>) => number

      • (source: Iterable<T>): number
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns number

take

  • take<T>(source: Iterable<T>, count: number): Iterable<T>
  • take<T>(count: number): (source: Iterable<T>) => Iterable<T>
  • Returns the elements of the iterable up to a specified count.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      The input collection.

    • count: number

      The number of items to take.

    Returns Iterable<T>

  • Returns the elements of the iterable up to a specified count.

    Type parameters

    • T

    Parameters

    • count: number

      The number of items to take.

    Returns (source: Iterable<T>) => Iterable<T>

      • (source: Iterable<T>): Iterable<T>
      • Parameters

        • source: Iterable<T>

          The input collection.

        Returns Iterable<T>

toArray

  • toArray<T>(source: Iterable<T>): T[]
  • Creates an array from the source iterable object.

    Type parameters

    • T

    Parameters

    • source: Iterable<T>

      A set objext to convert to an array.

    Returns T[]

Legend

  • Constructor
  • Property
  • Property

Generated using TypeDoc