array-to-hash-object
transfrom array to object according to the key parameter
Last updated 4 years ago by youngwind .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install array-to-hash-object 
SYNC missed versions from official npm registry.

What this package do?

Transform array to object with a custom hash key. For example.

var before = [
{
  id:1,
  name:"youngwind',
  age:24
},
{
 id:2,
 name:"xiaoye",
 age:30
}
];

// after
{
  1:{
    name:"youngwind",
    age:24
  },
  2:{
    name:"xiaoye",
    age:30
  }
}

Install

npm install array-to-hash-object --save

Usage

var arrayToHash = require('array-to-hash-object');
var after = arrayToHash(before,'id');
console.log(after);

Current Tags

  • 0.1.5                                ...           latest (4 years ago)

6 Versions

  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |