object-nest

0.1.2 • Public • Published

object-nest Build Status

Assign some property nestly

Installation

npm install --save object-nest

Example

const objectNest = require('object-nest');
// assign an object nestly
var obj = { a: 1 };
obj = objectNest(obj, 'b.c.d', 'hello');
// return Object
{
  a: 1,
  b: {
    c: {
      d: 'hello'
    }
  }
}
//create a new object nestly
obj = objectNest(null, 'a.b.c.d', 'hi');
// obj.a.b.c.d => 'hi'

License

MIT © EGOIST

Readme

Keywords

Package Sidebar

Install

npm i object-nest

Weekly Downloads

9

Version

0.1.2

License

MIT

Last publish

Collaborators

  • kchan