@amjs/utils 0.1.0
Set of tools as dotProp, etc.
Installation
$ npm i @amjs/utils-object
Usage
dotProp
const { dotProp } = require('@amjs/utils-object');
const context = {
key : {
value : 'value'
}
};
// Interface: dotProp(ref = {}, prop = '', value = '')
// Use two arguments in order to return a value
console.log(dotProp(context, 'key.value')); // 'value'
// Use additional 3rd argument to assign new value
dotProp(context, 'key.value', 'foo');
console.log(dotProp(context, 'key.value')); // 'foo'