0.6.1 • Published 5 years ago

extract.js v0.6.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Extract.js

Build Status Coverage Status Code Climate

Check or get nested properties on objects in javascript

Installation

Install the package from npm

npm install --save extract.js

Usage

extract.js is a tiny util library for either extracting or checking properties on a nested object, both dot and bracket notation.

import extract from 'extract.js';
const object = { foo: { bar: 'foobar' }, bar: [{foo: 'foobar'}] }
extract.get(object, 'foo.bar'); // => 'foobar'
extract.get(object, 'bar[0].foo'); // => 'foobar'
extract.get(object, 'foo.bar.foobar'); // => undefined
extract.has(object, 'foo.bar'); // => true
extract.has(object, 'foo.bar.foobar'); // => false

License

MIT. Copyright (c) 2016 Philip Knape.

0.6.1

5 years ago

0.6.0

5 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago