1.0.1 • Published 5 years ago

obj-group v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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']]
}
1.0.1

5 years ago

1.0.0

5 years ago