Transform a list of objects into an object, useful when you want to make your code more eloquent.
var objectify = require('node-objectify');
var countries = [
{
code: "us",
name: "United States"
},
{
code: "it",
name: "Italy"
}
]
countries = objectify(countries)
console.log(countries.us.name) // United States
As usual:
npm install --save node-objectiify
They are very minimal, as this library is a simple utility
to avoid some boilerplate code in your own app -- you can
run them through mocha / npm test
:
~/projects/node-objectify ᐅ npm test
node-objectify
objectify()
✓ should convert a list of objects into an object
1 passing (5ms)