scan

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
959 B
Scan is similar to [`reduce`](#reduce), but returns a list of successively reduced values from the left
1 contributor
Install scan as a package?
Copied
npm i @bit/justin-capalbo.ramda.scan
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
scan (
fn:Function,
acc:*,
list:Array
) : Array

Scan is similar to reduce, but returns a list of successively reduced values from the left

Example
const numbers = [1, 2, 3, 4];
     const factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24]
Arguments
fn: Function

The iterator function. Receives two values, the accumulator and the current element from the array

acc: *

The accumulator value.

list: Array

The list to iterate over.

Returns
Array

A list of all intermediately reduced values.

Help and resources