We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 35c4f04 + 352dd71 commit fd11b26Copy full SHA for fd11b26
index.js
@@ -280,6 +280,7 @@ function getPathValue(obj, path) {
280
function setPathValue(obj, path, val) {
281
var parsed = parsePath(path);
282
internalSetPathValue(obj, val, parsed);
283
+ return obj;
284
}
285
286
module.exports = {
test/index.js
@@ -216,4 +216,10 @@ describe('setPathValue', function () {
216
assert(obj.hello[1] === 2);
217
assert(obj.hello[2] === 3);
218
});
219
+
220
+ it('returns the object in which the value was set', function () {
221
+ var obj = { hello: [ 1, 2, 4 ] };
222
+ var valueReturned = pathval.setPathValue(obj, 'hello[2]', 3);
223
+ assert(obj === valueReturned);
224
+ });
225
0 commit comments