Install
Merge collections (objects) by key value. Somewhat similar to SQL join.
$ npm install merge-collections --save
Usage
var mergeCollections = ; var coll1 = id: 1 name: 'John' id: 2 name: 'Mary'; var coll2 = id: 1 lastName: 'Smith' id: 2 lastName: 'Jane'; ;//=> [{ id: 1, name: 'John', lastname: 'Smith' }, { id: 2, name: 'Mary', lastname: 'Jane' }];
Important
In the above example, the second collection (coll2
) will overwrite the values of first collection (coll1
) that share the same property.
License
MIT © Dennis Jin