unsafe-assign

1.0.0 • Public • Published

unsafe-assign

Assign to an object at an inner property, createing intermediate properties if necessary. Does not support intermediate arrays like lodash.set. Returns the original, modified object.

  • tiny
  • no dependencies
import assign from 'unsafe-assign';

let obj = {
  a: 'will be clobbered'
}

assign(obj, 'a.aa', {b: 'c'});
assign(obj, 'a.aa', {c: 'd'});

//{a: {aa: {b: 'c', c: 'd'}}}

Package Sidebar

Install

npm i unsafe-assign

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

1.3 kB

Total Files

3

Last publish

Collaborators

  • ennis