zip-with

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
965 B
Creates a new list out of the two supplied by applying the function to each equally-positioned pair in the lists.
1 contributor
Install zip-with as a package?
Copied
npm i @bit/justin-capalbo.ramda.zip-with
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
zipWith (
fn:Function,
list1:Array,
list2:Array
) : Array

Creates a new list out of the two supplied by applying the function to each equally-positioned pair in the lists. The returned list is truncated to the length of the shorter of the two input lists.

Example
const f = (x, y) => {
       // ...
     };
     R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']);
     //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')]
Arguments
fn: Function

The function used to combine the two elements into one value.

list1: Array

The first array to consider.

list2: Array

The second array to consider.

Returns
Array

The list made by combining same-indexed elements of `list1` and `list2` using `fn`.

Help and resources