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.
1 parent a8aa393 commit 352dd71Copy full SHA for 352dd71
index.js
@@ -293,6 +293,7 @@ function getPathValue(obj, path) {
293
function setPathValue(obj, path, val) {
294
var parsed = parsePath(path);
295
internalSetPathValue(obj, val, parsed);
296
+ return obj;
297
}
298
299
module.exports = {
test/index.js
@@ -208,4 +208,10 @@ describe('setPathValue', function () {
208
assert(obj.hello[1] === 2);
209
assert(obj.hello[2] === 3);
210
});
211
+
212
+ it('returns the object in which the value was set', function () {
213
+ var obj = { hello: [ 1, 2, 4 ] };
214
+ var valueReturned = pathval.setPathValue(obj, 'hello[2]', 3);
215
+ assert(obj === valueReturned);
216
+ });
217
0 commit comments