@amjs/utils-object

Set of tools as dotProp, etc.

Usage no npm install needed!

<script type="module">
  import amjsUtilsObject from 'https://cdn.skypack.dev/@amjs/utils-object';
</script>

README

@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'