getorset
v1.0.3
Published
Get or Set a value from object
Downloads
38
Readme
getorset
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![Dependency Status][david-image]][david-url] [npm-image]: https://img.shields.io/npm/v/getorset.svg?style=flat-square [npm-url]: https://npmjs.org/package/getorset [downloads-image]: http://img.shields.io/npm/dm/getorset.svg?style=flat-square [downloads-url]: https://npmjs.org/package/getorset [david-image]: http://img.shields.io/david/chunpu/getorset.svg?style=flat-square [david-url]: https://david-dm.org/chunpu/getorset
Get or Set a value from object
Installation
npm i getorset
Usage
getorset(object, key name[, default value])
var getorset = require('getorset')
var obj = {
foo: 'bar'
}
var ret = getorset(obj, 'foo2', [])
console.log(ret.foo2) // => []