obj-parse
Get and Set object properties in a Fast and Elegant way. (with caching and no dependencies!)
Inspire by angular $parse service
Note: This kit works great with deep-keys (creates an array composed of the own enumerable property names of an object).
Install
$ npm install --save obj-parse
Usage
var parse = ; //objectvar person1 = name: 'Ariel Mashraki' address: country: name: 'Israel' city: 'Tel Aviv' ; var person2 = name: 'Dan Louis' address: country: name: 'Canada' city: 'Toronto' ; //property gettervar nameGetter = ;; //Ariel Mashraki; //Dan Louis //nested propeties with dot notationvar cityGetter = ;; //Tel Aviv; //Toronto //bind a function { return personaddresscountryname === 'Canada';}var getter = ;; //false; //true //property setter, use the assign function//return function(scope, value)var countrySetter = assign;; //return person1 with changes; //return person2 with changes //use again in the ifCanadian; //true; //false
License
MIT © Ariel Mashraki