0.1.0 • Published 5 years ago

@amjs/utils-object v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@amjs/utils 0.1.0

Statements Branches Functions Lines

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'