Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 668 Bytes

README.md

File metadata and controls

27 lines (18 loc) · 668 Bytes

assign-set

Base on lodash.set, But the difference between Array and Array-like object

const assignSet = require('assign-set');

assignSet(obj, 'a.2.c', 'value');
obj = { a: { 2: { c: 'value' } } };

assignSet(obj, 'a[2].c', 'value');
obj = { a: [undefined, undefined, { c: 'value' }] };

The difference of lodash.set

const lodash = require('lodash.set');

assignSet(obj, 'a.2.c', 'value');
obj = { a: [undefined, undefined, { c: 'value' }] };

assignSet(obj, 'a[2].c', 'value');
obj = { a: [undefined, undefined, { c: 'value' }] };