Skip to content

merge

Given two arrays of the same type, iterate the first list and replace items matched by the `matcher` function in the first place. The given arrays are never modified.

Usage

merge(
[{ id: 1 }, { id: 2 }],
[{ id: 3 }, { id: 1, name: "John" }],
(obj) => obj.id,
);
// [{id: 1, name: 'John'}, {id: 2}]

Installation

Terminal window
npx atmx add helper merge