A small library that extracts specified keys from a single object or objects in an array.
npm install extrode
- Example usage for object arrays:
var extrode = require('extrode');
var dirtyArray = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6}];
var result = extrode(dirtyArray, ['x']);
Output should be [{ x: 1 }, { x: 3 }, { x: 5 }]
- Example usage for a single object:
var extrode = require('extrode');
var dirtyObject = { x: 1, y: 2 };
var result = extrode(dirtyObject, ['x']);
Output should be { x: 1 }
npm test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.