Closed mitjap closed 9 years ago
If I call _.setPath({}, {a: undefined}, ["some", "path"], {}) function returns { some: { path: {} } } instead of { some: { path: { a: undefined } } }
_.setPath({}, {a: undefined}, ["some", "path"], {})
{ some: { path: {} } }
{ some: { path: { a: undefined } } }
See jsfiddle example.
Sorry, my error.
Function works as expected. _.hasPath(obj, path) returns true for "some.path.a". I was using JSON.stringify for output which ignores undefined values
_.hasPath(obj, path)
true
JSON.stringify
If I call
_.setPath({}, {a: undefined}, ["some", "path"], {})
function returns{ some: { path: {} } }
instead of{ some: { path: { a: undefined } } }
See jsfiddle example.