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 306dce7 commit b504242Copy full SHA for b504242
dottie.js
@@ -198,7 +198,7 @@
198
for (key in object) {
199
value = object[key];
200
201
- if (typeof value === 'object') {
+ if (typeof value === 'object' && value !== null) {
202
paths = paths.concat(Dottie.paths(value, prefixes.concat([key])));
203
} else {
204
paths.push(prefixes.concat(key).join('.'));
test/paths.test.js
@@ -23,4 +23,13 @@ describe("dottie.paths", function() {
23
24
expect(dottie.paths(object)).to.eql(["a", "b.c", "b.d.e"]);
25
});
26
+
27
+ it("includes keys of null objects", function() {
28
+ var object = {
29
+ nonNullKey: 1,
30
+ nullKey: null
31
+ };
32
33
+ expect(dottie.paths(object)).to.eql(["nonNullKey", "nullKey"]);
34
+ });
35
0 commit comments