1.0.1 • Published 4 years ago

group-values-by-key v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

group-values-by-key

Build Status Coverage Status Maintainability Language grade: JavaScript tested with jest code style: prettier

Group values of two objects by their key

Install

$ npm install group-values-by-key

Usage

const groupValuesByKey = require("group-values-by-key");

const objects = [{ a: 2 }, { a: 3, b: 1 }];

groupValuesByKey(objects); //=> { a: [ 2, 3 ], b: [ 1 ] }

API

groupValuesByKey(objects) ⇒ Object

group values of two objects by their key

Returns: Object - object grouping values

ParamTypeDescription
objectsObject[]array of object

Example

groupValuesByKey({ a: 2 }, { a: 3, b: 1 }); //=> { a: [ 2, 3 ], b: [ 1 ] }

License

MIT © saxjst