Skip to content

Latest commit

 

History

History
83 lines (41 loc) · 1.15 KB

File metadata and controls

83 lines (41 loc) · 1.15 KB

Home > @josh-brown/vector > Vector > combine

Vector.combine() method

Constructs a vector by combining the values of two other vectors

Signature:

combine(other: Vector<S>, combineEntries: (a: S, b: S) => S): Vector<S>;

Parameters

Parameter

Type

Description

other

Vector<S>

The vector with which to combine this one

combineEntries

(a: S, b: S) => S

A function which takes an entry from each vector and returns a new entry

Returns:

Vector<S>

The new vector

Example

const first = vec([1, 2, 3]);
const second = vec([2, 3, 4]);

const combined = first.combine(second, (a, b) => a * b);
// [2, 6, 12]