{"_id":"group-object","_rev":"2786582","name":"group-object","description":"Group object keys and values into lists.","dist-tags":{"latest":"0.1.1"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2022-06-22T03:04:51.000Z","created":"2015-07-10T13:31:22.086Z","0.1.1":"2015-07-19T18:36:31.954Z","0.1.0":"2015-07-10T13:31:22.086Z"},"users":{},"author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/group-object.git"},"versions":{"0.1.1":{"name":"group-object","description":"Group object keys and values into lists.","version":"0.1.1","homepage":"https://github.com/doowb/group-object","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/group-object.git"},"bugs":{"url":"https://github.com/doowb/group-object/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"get-value":"^1.1.5","mocha":"*"},"dependencies":{"for-in":"^0.1.4","upsert-value":"^0.1.0"},"verb":{"related":{"list":["group-array","sort-object","get-value","set-value","upsert-value","for-in"]}},"gitHead":"5e34c095e2db6b0c83a6991d7597f1a5fa1c274e","_id":"group-object@0.1.1","_shasum":"fdcff297d47332808932182e7cf62bd2c7422a51","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.0","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"fdcff297d47332808932182e7cf62bd2c7422a51","size":2746,"noattachment":false,"key":"/group-object/-/group-object-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/group-object/download/group-object-0.1.1.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T14:19:36.736Z","publish_time":1437330991954,"_cnpm_publish_time":1437330991954},"0.1.0":{"name":"group-object","description":"Group object keys and values into lists.","version":"0.1.0","homepage":"https://github.com/doowb/group-object","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/group-object.git"},"bugs":{"url":"https://github.com/doowb/group-object/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"get-value":"^1.1.5","mocha":"*"},"dependencies":{"for-in":"^0.1.4","upsert-value":"^0.1.0"},"gitHead":"868541587a3c61d0ffdd53a698c98e4672eccde3","_id":"group-object@0.1.0","_shasum":"96cf7392edee61939dac91d1384247d4099d8595","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.0","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"96cf7392edee61939dac91d1384247d4099d8595","size":2746,"noattachment":false,"key":"/group-object/-/group-object-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/group-object/download/group-object-0.1.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_cnpmcore_publish_time":"2021-12-19T14:19:35.870Z","publish_time":1436535082086,"_cnpm_publish_time":1436535082086}},"readme":"# group-object [![NPM version](https://badge.fury.io/js/group-object.svg)](http://badge.fury.io/js/group-object)  [![Build Status](https://travis-ci.org/doowb/group-object.svg)](https://travis-ci.org/doowb/group-object)\n\n> Group object keys and values into lists.\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i group-object --save\n```\n\n## Usage\n\n```js\nvar groupBy = require('group-object');\n```\n\n## API\n\n### [groupBy](index.js#L62)\n\nCreate groupings from an object's keys and values.\n\n**Params**\n\n* `obj` **{Object}**: Object to group.\n* `grouper` **{Function}**: Optional grouping function that takes `acc, value, key, obj, setter`\n* `setter` **{Function}**: Optional setter function that takes `acc, group, value, key, obj`\n* `acc` **{Object}**: Optional accumulator object passed to the setter function.\n* `returns` **{Object}**: Object containing groups as keys and list of objects as values in the group.\n\n**Example**\n\n```js\nfunction grouper (acc, value, key, obj, setter) {\n  return value.group;\n}\n\nfunction setter (acc, group, value, key, obj) {\n  acc[group] = acc[group] || {};\n  acc[group][key] = value;\n}\n\nvar obj = {\n  a: { group: 'one', content: 'A'},\n  b: { group: 'one', content: 'B'},\n  c: { group: 'two', content: 'C'},\n  d: { group: 'two', content: 'D'},\n  e: { group: 'three', content: 'E'},\n  f: { group: 'three', content: 'F'}\n};\n\nvar groups = groupBy(obj, grouper, setter);\n//=> {\n//=>   one: {\n//=>     a: { group: 'one', content: 'A'},\n//=>     b: { group: 'one', content: 'B'}\n//=>   },\n//=>   two: {\n//=>     c: { group: 'two', content: 'C'},\n//=>     d: { group: 'two', content: 'D'}\n//=>   },\n//=>   three: {\n//=>     e: { group: 'three', content: 'E'},\n//=>     f: { group: 'three', content: 'F'}\n//=>   }\n//=> }\n```\n\n## Related projects\n\n* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in)\n* [group-array](https://github.com/doowb/group-array): Group array of objects into lists.\n* [get-value](https://github.com/jonschlinkert/get-value): Use property paths (`  a.b.c`) to get a nested value from an object.\n* [sort-object](https://github.com/doowb/sort-object): Sort the keys in an object.\n* [set-value](https://github.com/jonschlinkert/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.\n* [upsert-value](https://github.com/doowb/upsert-value): Update or set nested values and any intermediaries with dot notation (`'a.b.c'`) paths.\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/group-object/issues/new)\n\n## Author\n\n**Brian Woodward**\n\n+ [github/doowb](https://github.com/doowb)\n+ [twitter/doowb](http://twitter.com/doowb)\n\n## License\n\nCopyright © 2015 Brian Woodward\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 19, 2015._","_attachments":{},"homepage":"https://github.com/doowb/group-object","bugs":{"url":"https://github.com/doowb/group-object/issues"},"license":"MIT"}