{"name":"group-array","description":"Group array of objects into lists.","version":"0.3.0","homepage":"https://github.com/doowb/group-array","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/group-array.git"},"bugs":{"url":"https://github.com/doowb/group-array/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"for-own":"^0.1.3","kind-of":"^2.0.0","mocha":"^2.2.5","should":"^7.0.2","union-value":"^0.1.1"},"dependencies":{"get-value":"^1.1.5","kind-of":"^2.0.0"},"keywords":["array","group","item","list","nested","prop","properties","property"],"verb":{"related":{"list":["group-object","get-value","union-value","arr-reduce"]}},"gitHead":"7975c74c114b1549589905cee1a688a3d838cf6d","_id":"group-array@0.3.0","_shasum":"648657d3d2fd3b4443ef4be3ca7b33dd12ed31a9","_from":".","_npmVersion":"2.13.3","_nodeVersion":"0.12.0","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"648657d3d2fd3b4443ef4be3ca7b33dd12ed31a9","tarball":"http://registry-npm.ywwl.com/group-array/download/group-array-0.3.0.tgz","integrity":"sha512-9RE+xDfg4McbWIpjpzc/o75wayMmCImpSrl/mc+cOfIO1bR+xQD9lWWCi7D936yBAJrgxJ7kzZmfp9AKG+aTyw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFnEXmkXcCaQuQiw7LulLadDE7HYFlNe3sQmBO2UVZUjAiEAnOSOR0WfwnaaKaE/+xeKz9+0+TBFdsUkv2Qy4JOUH0o="}],"size":3142,"noattachment":false,"key":"/group-array/-/group-array-0.3.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"readme":"# group-array [![NPM version](https://img.shields.io/npm/v/group-array.svg?style=flat)](https://www.npmjs.com/package/group-array) [![NPM monthly downloads](https://img.shields.io/npm/dm/group-array.svg?style=flat)](https://npmjs.org/package/group-array) [![NPM total downloads](https://img.shields.io/npm/dt/group-array.svg?style=flat)](https://npmjs.org/package/group-array) [![Linux Build Status](https://img.shields.io/travis/doowb/group-array.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/group-array)\n\n> Group array of objects into lists.\n\nPlease consider following this project's author, [Brian Woodward](https://github.com/doowb), and consider starring the project to show your :heart: and support.\n\n- [Install](#install)\n- [Usage](#usage)\n- [Examples](#examples)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save group-array\n```\n\n## Usage\n\n```js\nvar groupArray = require('group-array');\n```\n\n## Examples\n\n```js\nvar arr = [\n  {tag: 'one', content: 'A'},\n  {tag: 'one', content: 'B'},\n  {tag: 'two', content: 'C'},\n  {tag: 'two', content: 'D'},\n  {tag: 'three', content: 'E'},\n  {tag: 'three', content: 'F'}\n];\n\n// group by the `tag` property\ngroupArray(arr, 'tag');\n```\n\n**results in:**\n\n```js\n{\n  one: [\n    {tag: 'one', content: 'A'},\n    {tag: 'one', content: 'B'}\n  ],\n  two: [\n    {tag: 'two', content: 'C'},\n    {tag: 'two', content: 'D'}\n  ],\n  three: [\n    {tag: 'three', content: 'E'},\n    {tag: 'three', content: 'F'}\n  ]\n}\n```\n\n**Group by multiple, deeply nested properties**\n\n```js\n// given an array of object, like blog posts...\nvar arr = [\n  { data: { year: '2016', tag: 'one', month: 'jan', day: '01'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'jan', day: '01'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'jan', day: '02'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'jan', day: '02'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'feb', day: '10'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'feb', day: '10'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'feb', day: '12'}, content: '...'},\n  { data: { year: '2016', tag: 'one', month: 'feb', day: '12'}, content: '...'},\n  { data: { year: '2016', tag: 'two', month: 'jan', day: '14'}, content: '...'},\n  { data: { year: '2016', tag: 'two', month: 'jan', day: '14'}, content: '...'},\n  { data: { year: '2016', tag: 'two', month: 'jan', day: '16'}, content: '...'},\n  { data: { year: '2016', tag: 'two', month: 'jan', day: '16'}, content: '...'},\n  { data: { year: '2016', tag: 'two', month: 'feb', day: '18'}, content: '...'},\n  { data: { year: '2017', tag: 'two', month: 'feb', day: '18'}, content: '...'},\n  { data: { year: '2017', tag: 'two', month: 'feb', day: '10'}, content: '...'},\n  { data: { year: '2017', tag: 'two', month: 'feb', day: '10'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'jan', day: '01'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'jan', day: '01'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'jan', day: '02'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'jan', day: '02'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'feb', day: '01'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'feb', day: '01'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'feb', day: '02'}, content: '...'},\n  { data: { year: '2017', tag: 'three', month: 'feb', day: '02'}, content: '...'}\n]\n```\n\nPass a list or array of properties:\n\n```js\ngroupArray(arr, 'data.year', 'data.tag', 'data.month', 'data.day');\n```\n\n**Results in something like this: (abbreviated)**\n\n```js\n{ '2016': \n   { one: \n      { jan: \n         { '01': \n            [ { data: { year: '2016', tag: 'one', month: 'jan', day: '01' },\n                content: '...' },\n              { data: { year: '2016', tag: 'one', month: 'jan', day: '01' },\n                content: '...' } ],\n           '02': \n            [ { data: { year: '2016', tag: 'one', month: 'jan', day: '02' },\n                content: '...' },\n              { data: { year: '2016', tag: 'one', month: 'jan', day: '02' },\n                content: '...' } ] },\n        feb: \n         { '10': \n            [ { data: { year: '2016', tag: 'one', month: 'feb', day: '10' },\n                content: '...' },\n              { data: { year: '2016', tag: 'one', month: 'feb', day: '10' },\n                content: '...' } ],\n           '12': \n            [ { data: { year: '2016', tag: 'one', month: 'feb', day: '12' },\n                content: '...' },\n              { data: { year: '2016', tag: 'one', month: 'feb', day: '12' },\n                content: '...' } ] } },\n     two: \n      { jan: \n         { '14': \n            [ { data: { year: '2016', tag: 'two', month: 'jan', day: '14' },\n                content: '...' },\n              { data: { year: '2016', tag: 'two', month: 'jan', day: '14' },\n                content: '...' } ],\n           '16': \n            [ { data: { year: '2016', tag: 'two', month: 'jan', day: '16' },\n                content: '...' },\n              { data: { year: '2016', tag: 'two', month: 'jan', day: '16' },\n                content: '...' } ] },\n        feb: \n         { '18': \n            [ { data: { year: '2016', tag: 'two', month: 'feb', day: '18' },\n                content: '...' } ] } } },\n  '2017': \n   { two: \n      { feb: \n         { '10': \n            [ { data: { year: '2017', tag: 'two', month: 'feb', day: '10' },\n                content: '...' },\n              { data: { year: '2017', tag: 'two', month: 'feb', day: '10' },\n                content: '...' } ],\n           '18': \n            [ { data: { year: '2017', tag: 'two', month: 'feb', day: '18' },\n                content: '...' } ] } },\n     three: \n      { jan: \n         { '01': \n            [ { data: { year: '2017', tag: 'three', month: 'jan', day: '01' },\n                content: '...' },\n              { data: { year: '2017', tag: 'three', month: 'jan', day: '01' },\n                content: '...' } ],\n           '02': \n            [ { data: { year: '2017', tag: 'three', month: 'jan', day: '02' },\n                content: '...' },\n              { data: { year: '2017', tag: 'three', month: 'jan', day: '02' },\n                content: '...' } ] },\n        feb: \n         { '01': \n            [ { data: { year: '2017', tag: 'three', month: 'feb', day: '01' },\n                content: '...' },\n              { data: { year: '2017', tag: 'three', month: 'feb', day: '01' },\n                content: '...' } ],\n           '02': \n            [ { data: { year: '2017', tag: 'three', month: 'feb', day: '02' },\n                content: '...' },\n              { data: { year: '2017', tag: 'three', month: 'feb', day: '02' },\n                content: '...' } ] } } } }\n```\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. | [homepage](https://github.com/jonschlinkert/arr-flatten \"Recursively flatten an array or arrays.\")\n* [get-value](https://www.npmjs.com/package/get-value): Use property paths like 'a.b.c' to get a nested value from an object. Even works… [more](https://github.com/jonschlinkert/get-value) | [homepage](https://github.com/jonschlinkert/get-value \"Use property paths like 'a.b.c' to get a nested value from an object. Even works when keys have dots in them (no other dot-prop library can do this!).\")\n* [group-object](https://www.npmjs.com/package/group-object): Group object keys and values into lists. | [homepage](https://github.com/doowb/group-object \"Group object keys and values into lists.\")\n* [union-value](https://www.npmjs.com/package/union-value): Set an array of unique values as the property of an object. Supports setting deeply… [more](https://github.com/jonschlinkert/union-value) | [homepage](https://github.com/jonschlinkert/union-value \"Set an array of unique values as the property of an object. Supports setting deeply nested properties using using object-paths/dot notation.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 32 | [doowb](https://github.com/doowb) |  \n| 13 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 2  | [johlym](https://github.com/johlym) |  \n| 1  | [cperryk](https://github.com/cperryk) |  \n\n### Author\n\n**Brian Woodward**\n\n* [GitHub Profile](https://github.com/doowb)\n* [Twitter Profile](https://twitter.com/doowb)\n* [LinkedIn Profile](https://linkedin.com/in/woodwardbrian)\n\n### License\n\nCopyright © 2019, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 22, 2019._","publish_time":1438635562851,"_cnpm_publish_time":1438635562851,"dist-tags":{"latest":"1.0.0"}}