Get Set Deep ![Build Status](https://secure.travis-ci.org/bevry/getsetdeep.png?branch=master)
Get and set nested variables of an object, includes support for Backbone Models
Install
Backend
- Install Node.js
npm install --save getsetdeep
Frontend
- See Browserify
Usage
Example
var getsetdeep = require('getsetdeep')
var obj = {
a: {
b: {
c: 3
}
}
}
getsetdeep.getDeep(obj, 'a.b.c')
getsetdeep.setDeep(obj, 'a.b.c', 4)
getsetdeep.getDeep(obj, 'a.b.c')
Notes
setDeep
also has a fourth argument called setOnlyIfEmpty
which defaults to false
, if specified to true
then setDeep
will only set the value if the current value is null
or undefined
- We also work with Backbone Models (or rather any model that utilizes an
attributes
object)
History
You can discover the history inside the History.md file
License
Licensed under the incredibly permissive MIT License
Copyright © 2013+ Bevry Pty Ltd
Copyright © 2011-2012 Benjamin Arthur Lupton