+2
-1
@@ -80,3 +80,4 @@ module.exports = slice; | ||
| } else { | ||
| return; | ||
| obj[prop] = {}; | ||
| obj = obj[prop]; | ||
| } | ||
@@ -83,0 +84,0 @@ } |
+1
-1
| { | ||
| "name": "pathos", | ||
| "version": "0.2.1", | ||
| "version": "0.2.2", | ||
| "description": "Decompose a javascript object into a set of path/value slices.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+18
-1
@@ -125,3 +125,3 @@ var expect = require('expect.js'), | ||
| it('should be able to set an objectd field with a path and value', | ||
| it('should be able to set an object field with a path and value', | ||
| function(done) { | ||
@@ -182,2 +182,19 @@ var o = { | ||
| }); | ||
| it('should handle setting of new properties', function(done) { | ||
| var o = { | ||
| nothing: 'here' | ||
| } | ||
| pathos.set(o, [ 'cars', '1', 'make' ], 'Toyoda'); | ||
| var expected = { | ||
| nothing: 'here', | ||
| cars: { | ||
| '1': { | ||
| make: 'Toyoda' | ||
| } | ||
| } | ||
| }; | ||
| expect(o).to.eql(expected); | ||
| done(); | ||
| }); | ||
| }); |
13927
2.69%264
6.88%