lukeed / dset

A tiny (197B) utility for safely writing deep Object values~!
MIT License
759 stars 25 forks source link

`dset` creates array instead of object for nested empty string property #35

Open bgoscinski opened 2 years ago

bgoscinski commented 2 years ago

This test currently fails:

    objects(`should ${verb} empty string property`, () => {
        let { input } = prepare({});

        dset(input, ["hello", ""], 123);

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

with

   FAIL  objects  "should merge empty string property"
    Expected values to be deeply equal:  (equal)

        ··{
        Actual:
        --··"hello":·[]
        Expected:
        ++··"hello":·{
        ++····"":·123
        ++··}
        ··}