Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Reducer

Functions to be used in {@link Array.prototype.reduce} as a callback.

see

https://pavel-surinin.github.io/declarativejs/#/?id=reducers

Index

Type aliases

IsMergable

IsMergable<T>: (currentValue: T, aggregatorValue: T, key: string) => boolean

Type parameters

  • T = any

Type declaration

    • (currentValue: T, aggregatorValue: T, key: string): boolean
    • Parameters

      • currentValue: T
      • aggregatorValue: T
      • key: string

      Returns boolean

OnDuplicateFunction

OnDuplicateFunction<K>: (v1: K, v2: K, key: string) => K | never

Type parameters

  • K

Type declaration

    • (v1: K, v2: K, key: string): K | never
    • Parameters

      • v1: K
      • v2: K
      • key: string

      Returns K | never

Variables

MergeStrategy

MergeStrategy: Record<"OVERRIDE" | "UNIQUE" | "CHECKED", IsMergable> = ...

Object merging strategy used in {@link Reducer#toMergedObject}

see

toMergedObject

Functions

ImmutableMap

ImmutableObject

Map

Const Partition

  • Partition<E>(): Tuple<E, E>

Const flat

  • flat<T>(agr: T[], value: T[]): T[]

groupBy

  • groupBy<T, K>(key: K): <A>(agr: A, value: T, index: number, array: T[]) => A
  • groupBy<T>(getKey: Getter<T, string>): <A>(agr: A, value: T, index: number, array: T[]) => A
  • groupBy<T, TR>(getKey: Getter<T, string>, transformer: Getter<T, TR>): <A>(agr: A, value: T, index: number, array: T[]) => A
  • groupBy<T, TR, K>(key: K, transformer: Getter<T, TR>): <A>(agr: A, value: T, index: number, array: T[]) => A
  • Function to be used in {@link Array.prototype.reduce} as a callback to group by provided key. As second parameter in reduce function need to pass Reducer.Map() Reducer.ImmutableMap() Or own implementation of MethodMap

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=groupby

    Type parameters

    • T

    • K: string | number | symbol

    Parameters

    • key: K

      objects key to resolve value,to group by it

    Returns <A>(agr: A, value: T, index: number, array: T[]) => A

      • <A>(agr: A, value: T, index: number, array: T[]): A
  • Groups an array by key resolved from callback. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided function. As second parameter in reduce function need to pass Reducer.Map() Reducer.ImmutableMap() Or own implementation of MethodMap

    throws

    {Error} if resolved key from callback is not a string

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=groupby

    Type parameters

    • T

    Parameters

    • getKey: Getter<T, string>

      callback to resolve key,to group by it

    Returns <A>(agr: A, value: T, index: number, array: T[]) => A

      • <A>(agr: A, value: T, index: number, array: T[]): A
      • Groups an array by key resolved from callback. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided function. As second parameter in reduce function need to pass Reducer.Map() Reducer.ImmutableMap() Or own implementation of MethodMap

        throws

        {Error} if resolved key from callback is not a string

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=groupby

        Type parameters

        Parameters

        • agr: A
        • value: T
        • index: number
        • array: T[]

        Returns A

  • Groups an array by key resolved from callback and transform value to put in new grouped array. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided key. As second parameter in reduce function need to pass {@link Reducer.Map()}, {@link Reducer.ImmutableMap()} or own implementation of MethodMap

    export
    throws

    {Error} if resolved key from callback is not a string

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=groupby

    Type parameters

    • T

      type of element in array

    • TR

      type of element in grouped array

    Parameters

    • getKey: Getter<T, string>

      function to get key, output must be a string by this key an array will be grouped

    • transformer: Getter<T, TR>

      function to transform array element in grouped array

    Returns <A>(agr: A, value: T, index: number, array: T[]) => A

         function to use in Array.reduce
    
      • <A>(agr: A, value: T, index: number, array: T[]): A
      • Groups an array by key resolved from callback and transform value to put in new grouped array. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided key. As second parameter in reduce function need to pass {@link Reducer.Map()}, {@link Reducer.ImmutableMap()} or own implementation of MethodMap

        export
        throws

        {Error} if resolved key from callback is not a string

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=groupby

        Type parameters

        Parameters

        • agr: A
        • value: T
        • index: number
        • array: T[]

        Returns A

             function to use in Array.reduce
        
  • Groups an array by key and transform value to put in new grouped array. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided key. As second parameter in reduce function need to pass {@link Reducer.Map()}, {@link Reducer.ImmutableMap()} or own implementation of MethodMap

    export
    see

    https://pavel-surinin.github.io/declarativejs/#/?id=groupby

    Type parameters

    • T

      type of element in array

    • TR

      type of element in grouped array

    • K: string | number | symbol

    Parameters

    • key: K

      of an element in array object to group by it

    • transformer: Getter<T, TR>

      function to transform array element in grouped array

    Returns <A>(agr: A, value: T, index: number, array: T[]) => A

         function to use in Array.reduce
    
      • <A>(agr: A, value: T, index: number, array: T[]): A
      • Groups an array by key and transform value to put in new grouped array. Function to be used in {@link Array.prototype.reduce} as a callback to group by provided key. As second parameter in reduce function need to pass {@link Reducer.Map()}, {@link Reducer.ImmutableMap()} or own implementation of MethodMap

        export
        see

        https://pavel-surinin.github.io/declarativejs/#/?id=groupby

        Type parameters

        Parameters

        • agr: A
        • value: T
        • index: number
        • array: T[]

        Returns A

             function to use in Array.reduce
        

groupByObject

  • groupByObject<T, K>(key: K): (agr: Partial<Record<Extract<T[K], string>, T[]>>, value: T, index: number, array: T[]) => Partial<Record<Extract<T[K], string>, T[]>>
  • groupByObject<T, K>(getKey: Getter<T, K>): (agr: Partial<Record<K, T[]>>, value: T, index: number, array: T[]) => Partial<Record<K, T[]>>
  • groupByObject<T, TR, K>(getKey: Getter<T, K>, transformer: Getter<T, TR>): (agr: Partial<Record<K, TR[]>>, value: T, index: number, array: T[]) => Partial<Record<K, TR[]>>
  • groupByObject<T, TR, K>(key: K, transformer: Getter<T, TR>): (agr: Partial<Record<Extract<T[K], string>, TR[]>>, value: T, index: number, array: T[]) => Partial<Record<Extract<T[K], string>, TR[]>>
  • Type parameters

    • T

    • K: string | number | symbol

    Parameters

    • key: K

    Returns (agr: Partial<Record<Extract<T[K], string>, T[]>>, value: T, index: number, array: T[]) => Partial<Record<Extract<T[K], string>, T[]>>

      • (agr: Partial<Record<Extract<T[K], string>, T[]>>, value: T, index: number, array: T[]): Partial<Record<Extract<T[K], string>, T[]>>
      • Parameters

        • agr: Partial<Record<Extract<T[K], string>, T[]>>
        • value: T
        • index: number
        • array: T[]

        Returns Partial<Record<Extract<T[K], string>, T[]>>

  • Type parameters

    • T

    • K: string

    Parameters

    Returns (agr: Partial<Record<K, T[]>>, value: T, index: number, array: T[]) => Partial<Record<K, T[]>>

      • (agr: Partial<Record<K, T[]>>, value: T, index: number, array: T[]): Partial<Record<K, T[]>>
      • Parameters

        • agr: Partial<Record<K, T[]>>
        • value: T
        • index: number
        • array: T[]

        Returns Partial<Record<K, T[]>>

  • Type parameters

    • T

    • TR

    • K: string

    Parameters

    Returns (agr: Partial<Record<K, TR[]>>, value: T, index: number, array: T[]) => Partial<Record<K, TR[]>>

      • (agr: Partial<Record<K, TR[]>>, value: T, index: number, array: T[]): Partial<Record<K, TR[]>>
      • Parameters

        • agr: Partial<Record<K, TR[]>>
        • value: T
        • index: number
        • array: T[]

        Returns Partial<Record<K, TR[]>>

  • Type parameters

    • T

    • TR

    • K: string | number | symbol

    Parameters

    • key: K
    • transformer: Getter<T, TR>

    Returns (agr: Partial<Record<Extract<T[K], string>, TR[]>>, value: T, index: number, array: T[]) => Partial<Record<Extract<T[K], string>, TR[]>>

      • (agr: Partial<Record<Extract<T[K], string>, TR[]>>, value: T, index: number, array: T[]): Partial<Record<Extract<T[K], string>, TR[]>>
      • Parameters

        • agr: Partial<Record<Extract<T[K], string>, TR[]>>
        • value: T
        • index: number
        • array: T[]

        Returns Partial<Record<Extract<T[K], string>, TR[]>>

max

  • max(agr: number, value: number, index: number, array: number[]): number

min

  • min(agr: number, value: number, index: number, array: number[]): number

pairwise

  • pairwise<T>(): (agr: Tuple<T, T>[], value: T, index: number, array: T[]) => Tuple<T, T>[]

partitionBy

  • partitionBy<T>(matches: Predicate<T>): (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>
  • partitionBy<T, K>(matches: K): (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>
  • partitionBy<T>(matches: Partial<T>): (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>
  • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is a function that takes current element as a parameter and returns boolean.

    export
    see

    Reducer.Partition

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

    Type parameters

    • T

      element type in array

    Parameters

    • matches: Predicate<T>

      predicate function that has a a value current element and returns boolean

    Returns (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>

    function to pass to Array.reduce

      • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is a function that takes current element as a parameter and returns boolean.

        export
        see

        Reducer.Partition

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

        Parameters

        • agr: Tuple<T[], T[]>
        • value: T

        Returns Tuple<T[], T[]>

        function to pass to Array.reduce

  • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is an objects key, that will be coerced to boolean with Boolean constructor (Boolean()).

    export
    see

    Reducer.Partition

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

    Type parameters

    • T

      element type in array

    • K: string | number | symbol

    Parameters

    • matches: K

      element key, which value is used to decide in which partition array to add element

    Returns (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>

    function to pass to Array.reduce

      • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is an objects key, that will be coerced to boolean with Boolean constructor (Boolean()).

        export
        see

        Reducer.Partition

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

        Parameters

        • agr: Tuple<T[], T[]>
        • value: T

        Returns Tuple<T[], T[]>

        function to pass to Array.reduce

  • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is an object, which key and values must match current element. For matching all key-value pairs, element will be placed in first partition array.

    export
    see

    Reducer.Partition

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

    Type parameters

    • T

      element type in array

    Parameters

    • matches: Partial<T>

      object to match key value pairs in current element

    Returns (agr: Tuple<T[], T[]>, value: T) => Tuple<T[], T[]>

    function to pass to Array.reduce

      • Function to be used in {@link Array.prototype.reduce} as a callback. It reduces array in a tuple ([[], []]) with two arrays. First array contains elements, that matches predicate, second array, that does not match. As a second paramter in reduce (callback, initialValue), as an initial value need to pass empty tuple of arrays ([[], []]) Or use Reducer.Partition function to create initial value for it. Predicate is an object, which key and values must match current element. For matching all key-value pairs, element will be placed in first partition array.

        export
        see

        Reducer.Partition

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=partitionby

        Parameters

        • agr: Tuple<T[], T[]>
        • value: T

        Returns Tuple<T[], T[]>

        function to pass to Array.reduce

scan

  • scan<T, R>(accFunction: (acc: R, current: T) => R, initial: R): (agr: R[], value: T) => R[]
  • Function to be used in {@link Array.prototype.reduce} as a callback. Applies an accumulator function over the current element and returns each intermediate result for accumulation

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=scan

    Type parameters

    • T

    • R

    Parameters

    • accFunction: (acc: R, current: T) => R

      accumulator function

        • (acc: R, current: T): R
        • Parameters

          • acc: R
          • current: T

          Returns R

    • initial: R

      value

    Returns (agr: R[], value: T) => R[]

      • (agr: R[], value: T): R[]
      • Parameters

        • agr: R[]
        • value: T

        Returns R[]

Const sum

  • sum(agr: number, value: number): number

toMap

  • Function to be used in {@link Array.prototype.reduce} as a callback to make a Map. Collects items by key, from callback to {@link MethodMap}. If function resolves key, that already exists it will throw an Error As second parameter in reduce function need to pass Reducer.Map(), Reducer.ImmutableMap(), Or own implementation of MethodMap

    throws

    Error if resolved key from callback is not a string

    throws

    Error if map has duplicate keys will thrown error

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=tomap

    Type parameters

    • T

    Parameters

    • getKey: Getter<T, string>

      callback to get key from value

    Returns (agr: MethodMap<T>, value: T, index: number, array: T[]) => MethodMap<T>

      • Function to be used in {@link Array.prototype.reduce} as a callback to make a Map. Collects items by key, from callback to {@link MethodMap}. If function resolves key, that already exists it will throw an Error As second parameter in reduce function need to pass Reducer.Map(), Reducer.ImmutableMap(), Or own implementation of MethodMap

        throws

        Error if resolved key from callback is not a string

        throws

        Error if map has duplicate keys will thrown error

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=tomap

        Parameters

        • agr: MethodMap<T>

          object to collect in

        • value: T

          value that that is passed in function for each iteration

        • index: number
        • array: T[]

        Returns MethodMap<T>

  • Function to be used in {@link Array.prototype.reduce} as a callback to make a Map. Collects items to {@link MethodMap} by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass Reducer.Map(), Reducer.ImmutableMap(), Or own implementation of MethodMap

    throws

    {Error} if map has duplicate keys will thrown error

    throws

    {Error} if resolved key from callback is not a string

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=tomap

    Type parameters

    • T

    • K

    Parameters

    • getKey: Getter<T, string>

      callback to get key from value

    • valueGetter: Getter<T, K>

    Returns (agr: MethodMap<K>, value: T, index: number, array: T[]) => MethodMap<K>

      • Function to be used in {@link Array.prototype.reduce} as a callback to make a Map. Collects items to {@link MethodMap} by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass Reducer.Map(), Reducer.ImmutableMap(), Or own implementation of MethodMap

        throws

        {Error} if map has duplicate keys will thrown error

        throws

        {Error} if resolved key from callback is not a string

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=tomap

        Parameters

        • agr: MethodMap<K>
        • value: T
        • index: number
        • array: T[]

        Returns MethodMap<K>

toMergedObject

  • toMergedObject(isMergable?: IsMergable<any>): <T, R>(agr: R, value: T) => T & R

toObject

  • toObject<T>(getKey: Getter<T, string>): (agr: StringMap<T>, value: T, index: number, array: T[]) => StringMap<T>
  • toObject<T, K>(getKey: Getter<T, string>, valueGetter: Getter<T, K>): (agr: StringMap<K>, value: T, index: number, array: T[]) => StringMap<K>
  • toObject<T, K>(getKey: Getter<T, string>, valueGetter: Getter<T, K>, merge: (v1: K, v2: K) => K): (agr: StringMap<K>, value: T, index: number, array: T[]) => StringMap<K>
  • Function to be used in {@link Array.prototype.reduce} as a callback. Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

    throws

    {Error} if map has duplicate keys will thrown error

    throws

    {Error} if resolved key from callback is not a string * *

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=toobject

    Type parameters

    • T

    Parameters

    • getKey: Getter<T, string>

      callback to get key from value

    Returns (agr: StringMap<T>, value: T, index: number, array: T[]) => StringMap<T>

      • Function to be used in {@link Array.prototype.reduce} as a callback. Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

        throws

        {Error} if map has duplicate keys will thrown error

        throws

        {Error} if resolved key from callback is not a string * *

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=toobject

        Parameters

        • agr: StringMap<T>
        • value: T
        • index: number
        • array: T[]

        Returns StringMap<T>

  • Function to be used in {@link Array.prototype.reduce} as a callback Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

    throws

    {Error} if map has duplicate keys will thrown error

    throws

    {Error} if resolved key from callback is not a string *

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=toobject

    Type parameters

    • T

    • K

    Parameters

    • getKey: Getter<T, string>

      callback to get key from value

    • valueGetter: Getter<T, K>

    Returns (agr: StringMap<K>, value: T, index: number, array: T[]) => StringMap<K>

      • Function to be used in {@link Array.prototype.reduce} as a callback Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

        throws

        {Error} if map has duplicate keys will thrown error

        throws

        {Error} if resolved key from callback is not a string *

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=toobject

        Parameters

        • agr: StringMap<K>
        • value: T
        • index: number
        • array: T[]

        Returns StringMap<K>

  • Function to be used in {@link Array.prototype.reduce} as a callback Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

    throws

    {Error} if resolved key from callback is not a string *

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=toobject

    Type parameters

    • T

    • K

    Parameters

    • getKey: Getter<T, string>

      callback to get key from value

    • valueGetter: Getter<T, K>
    • merge: (v1: K, v2: K) => K

      callback to merge values with duplicate key

        • (v1: K, v2: K): K
        • Parameters

          • v1: K
          • v2: K

          Returns K

    Returns (agr: StringMap<K>, value: T, index: number, array: T[]) => StringMap<K>

      • Function to be used in {@link Array.prototype.reduce} as a callback Collects items to object by key from callback. If function resolves key, that already exists it will throw an Error. Second callback is value mapper. As second parameter in reduce function need to pass {} or Reducer.ImmutableObject()

        throws

        {Error} if resolved key from callback is not a string *

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=toobject

        Parameters

        • agr: StringMap<K>
        • value: T
        • index: number
        • array: T[]

        Returns StringMap<K>

unzip

  • unzip<T>(): (agr: T[][], value: T[], index: number, arrays: T[][]) => T[][]
  • Function to be used in {@link Array.prototype.reduce} as a callback. It does the opposite as Reducer.zip or Reducer.zipAll. It collects from all zipped arrays one arrays, that was before zip. Takes from each nested arrays and element and for each index will collect to new array. The length of and array will be the shortest length of arrays to unzip

    export
    see

    Reducer.zip

    see

    Reducer.zipAll

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=unzip

    Type parameters

    • T

    Returns (agr: T[][], value: T[], index: number, arrays: T[][]) => T[][]

    function to use in Array.reduce

      • (agr: T[][], value: T[], index: number, arrays: T[][]): T[][]
      • Parameters

        • agr: T[][]
        • value: T[]
        • index: number
        • arrays: T[][]

        Returns T[][]

zip

  • zip<T1, T2>(array: T2[]): (agr: Tuple<T1, T2>[], value: T1, index: number) => Tuple<T1, T2>[]
  • zip<T1, T2, R>(array: T2[], withFx: (t1: T1, t2: T2) => R): (agr: R[], value: T1, index: number) => R[]
  • Function to be used in {@link Array.prototype.reduce} as a callback. Collects two arrays into one array of tuples, two element array([x ,y]). The length of zipped array will be length of shortest array.

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=zip

    Type parameters

    • T1

    • T2

    Parameters

    • array: T2[]

      array to zip with

    Returns (agr: Tuple<T1, T2>[], value: T1, index: number) => Tuple<T1, T2>[]

    array with elements from two arrays as tuples

      • (agr: Tuple<T1, T2>[], value: T1, index: number): Tuple<T1, T2>[]
      • Function to be used in {@link Array.prototype.reduce} as a callback. Collects two arrays into one array of tuples, two element array([x ,y]). The length of zipped array will be length of shortest array.

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=zip

        Parameters

        • agr: Tuple<T1, T2>[]
        • value: T1
        • index: number

        Returns Tuple<T1, T2>[]

        array with elements from two arrays as tuples

  • Function to be used in {@link Array.prototype.reduce} as a callback. Collects two arrays into one array of aggregated objects by provided function. The length of zipped array will be length of shortest array.

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=zip

    Type parameters

    • T1

    • T2

    • R

    Parameters

    • array: T2[]

      array to zip with

    • withFx: (t1: T1, t2: T2) => R

      function that will combine two elements into one

        • (t1: T1, t2: T2): R
        • Parameters

          • t1: T1
          • t2: T2

          Returns R

    Returns (agr: R[], value: T1, index: number) => R[]

    array with elements from two arrays

      • (agr: R[], value: T1, index: number): R[]
      • Function to be used in {@link Array.prototype.reduce} as a callback. Collects two arrays into one array of aggregated objects by provided function. The length of zipped array will be length of shortest array.

        see

        https://pavel-surinin.github.io/declarativejs/#/?id=zip

        Parameters

        • agr: R[]
        • value: T1
        • index: number

        Returns R[]

        array with elements from two arrays

zipAll

  • zipAll(...arraysToZip: any[][]): (agr: any[][], currentValue: any, currentValueIndex: number) => any[][]
  • Function to be used in {@link Array.prototype.reduce} as a callback. Collects all arrays to arrays of arrays, with elements at being grouped with elements from other arrays by same index. The length of zipped array will be length of shortest array. Almost the same as Reducer.zip, except zipAll accepts multiple array to zip with.

    export
    see

    Reducer.zip

    see

    https://pavel-surinin.github.io/declarativejs/#/?id=zipall

    Parameters

    • Rest ...arraysToZip: any[][]

    Returns (agr: any[][], currentValue: any, currentValueIndex: number) => any[][]

    function to use in Array.reduce

      • (agr: any[][], currentValue: any, currentValueIndex: number): any[][]
      • Parameters

        • agr: any[][]
        • currentValue: any
        • currentValueIndex: number

        Returns any[][]

Generated using TypeDoc