documentcloud / underscore-contrib

The brass buckles on Underscore's utility belt
MIT License
621 stars 117 forks source link

_.setPath removes undefined values on new value #207

Closed mitjap closed 9 years ago

mitjap commented 9 years ago

If I call _.setPath({}, {a: undefined}, ["some", "path"], {}) function returns { some: { path: {} } } instead of { some: { path: { a: undefined } } }

See jsfiddle example.

mitjap commented 9 years ago

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