lukeed / dset

A tiny (194B) utility for safely writing deep Object values~!
MIT License
754 stars 22 forks source link

`dset` throws when encountering `null` in object #36

Open bgoscinski opened 2 years ago

bgoscinski commented 2 years ago

This test currently fails:

  objects(`should ${verb} null values`, () => {
    let { input } = prepare({ hello: null });

    dset(input, ['hello', 'a'], 123);

    assert.equal(input, {
      hello: { a: 123 },
    });
  });

with:

   FAIL  objects  "should overwrite null values"
    Cannot set properties of null (setting 'a')

lodash.set correctly overwrites null.