setnested
An easy way to get/set Javascript literals with path namespace
Why setnested
- Lightweight (~1kB min&gzip)
- Array support
- Object support
- Creates when doesn't exist
- Returns/Change when exist
- Fast
- Easy
CDN
Installing
$ npm install setnested
# or
$ yarn add setnested
Using
// CommonJS / NodeJS
var nested = require('setnested');
// ES6
import { set, get } from 'setnested';
// Browser
// HTML Tag: <script src="https://unpkg.com/setnested"></script>
// Now you have access via `window.nested`
Usage
var yourObject = nested.set({'myAccess.to.property': true})
};
Methods
get
nested.get(yourObject, 'myAccess.to.property') // get value via string
set
nested.set(yourObject); // parsed object
License
Licensed under MIT-License, do everything, use it