Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

group-from

0.3.1 • Public • Published

group-from

npm version Build Status

Create group from a property object value


Install

npm i group-from

Usage

const groupFrom = require('group-form');
 
const data = [
  {
    parent: {
      child: {
        categories: [
          'foo',
          'bar',
        ],
      },
    },
  },
  {
    parent: {
      child: {
        categories: [
          'foo',
          'baz',
        ],
      },
    },
  },
];
 
console.log(groupFrom(data, 'parent.child.categories'));
 

output.

{ foo: [ { parent: [Object] }, { parent: [Object] } ],
  bar: [ { parent: [Object] } ],
  baz: [ { parent: [Object] } ] }

Keywords

none

Install

npm i group-from

DownloadsWeekly Downloads

1

Version

0.3.1

License

MIT

Last publish

Collaborators

  • avatar