keyed-array
Recursively add named keys to arrays of objects
I wrote a blog post about the idea here: http://zeke.sikelianos.com/keyed-arrays-in-javascript
Installation
npm install keyed-array --save
Usage
For more extensive usage examples, see test.js
const keyedArray = let people = id: 'bob' name: 'Bob' isCool: false id: 'sue' name: 'Sue' isCool: false id: 'hal' name: 'Hal' isCool: true id: 'ann' name: 'Ann' isCool: true people = // `people` is still an array, but now it also has keys based on the `id`// value of each objectpeoplebob// {id: 'bob', name: 'Bob', isCool: false}
Tests
npm installnpm test
Dependencies
None
Dev Dependencies
- standard: JavaScript Standard Style
- tap-spec: Formatted TAP output like Mocha's spec reporter
- tape: tap-producing test harness for node and browsers
License
MIT
Generated by package-json-to-readme