0o001 / extrode

simple key extractor for objects and arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

extrode

Build Status Coverage Status npm version

A small library that extracts specified keys from a single object or objects in an array.

Installation

npm install extrode

Usage

  • 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 = dirtyArray.extrode(['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 = dirtyObject.extrode(['x']);

Output should be { x: 1 }

Tests

npm test

Contributing

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.

About

simple key extractor for objects and arrays

License:MIT License


Languages

Language:JavaScript 100.0%