obj-group

1.0.1 • Public • Published

obj-group

module for helping to group array item into an object with a key that self-determined

How To Use

npm i obj-group --save

// <Import the function>
const objGroup = require('obj-group');

//input data in array form :
const value = [
    ['sniper', 'agility', "ranged"],
    ['axe', 'strength', 'melee'],
    ['tusk', 'strength', 'melee'],
    ['crystal maiden', 'intelligence', 'ranged'],
    ['phantom assasin', 'agility', 'melee'],
    ['windrunner', 'intelligence', 'ranged']];

const actualRes = objGroup(value, 1);
console.log(actualRes);

result :

{
    strength: [['axe', 'melee'], ['tusk', 'melee']],
    agility: [['sniper', 'ranged'], ['phantom assasin', 'melee']],
    intelligence: [['crystal maiden', 'ranged'], ['windrunner', 'ranged']]
}

Readme

Keywords

Package Sidebar

Install

npm i obj-group

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

5.08 kB

Total Files

4

Last publish

Collaborators

  • michaelwp