4.0.0 • Published 7 years ago

starry.reduce v4.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Member of the starry suite—modular functions for iterable objects.

npm node

Status

Applies to the whole suite.

Build Status Coverage Status

Usage

function reduce<T = any>(
  iterable: Iterable<T>, 
  accumulator: (previousValue: T, currentValue: T) => T
  ): T
function reduce<T = any, U = any>(
  iterable: Iterable<T>,
  accumulator: (previousValue: U, currentValue: T) => U,
  initialValue: U
  ): U

Applies an accumulator function over an iterable.

Parameters:

  • iterable: Iterable<T>
  • accumulator: (previousValue, currentValue) - An accumulator function over the iterable.
    • previousValue - The accumulate or the initial value.
    • current - The current item of the iterable. Must return - The new accumulate.
  • initialValue - Optional via argument length. The initial accumulator value.

This works like Array.prototype.reduce.

4.0.0

7 years ago

3.0.0

8 years ago

3.0.0-1

8 years ago

3.0.0-0

8 years ago

2.0.0

8 years ago

2.0.0-0

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago