dottie
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -110,6 +110,9 @@ (function(undefined) { | ||
} | ||
current = current[piece]; | ||
if (current === null) { | ||
delete transformed[key]; | ||
break; | ||
} | ||
} | ||
} else { | ||
transformed[key] = transformed[key]; // Ensure that properties exist on the object, not just the prototype | ||
} | ||
@@ -116,0 +119,0 @@ } |
{ | ||
"name": "dottie", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"devDependencies": { | ||
@@ -5,0 +5,0 @@ "expect.js": "~0.2.0", |
@@ -88,2 +88,17 @@ var expect = require("expect.js"), | ||
}); | ||
it("should be able to handle null valued properties, not assigning nested level objects", function() { | ||
var values = { | ||
'section.id': 20, | ||
'section.layout': null, | ||
'section.layout.id': null, | ||
'section.layout.name': null | ||
}; | ||
var transformed = dottie.transform(values); | ||
expect(transformed.section.layout).to.be(null); | ||
expect(transformed['section.layout.id']).to.be(undefined); | ||
expect(transformed['section.layout.name']).to.be(undefined); | ||
}); | ||
}); |
12627
333