Skip to content

Commit 9db0a68

Browse files
committed
Protect against incomplete properties in JSON
1 parent f44ef20 commit 9db0a68

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/instance.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export const values = function* (node) {
118118
}
119119

120120
for (const property of node.children) {
121-
yield property.children[1];
121+
if (property.children[1]) {
122+
yield property.children[1];
123+
}
122124
}
123125
};
124126

@@ -128,7 +130,9 @@ export const entries = function* (node) {
128130
}
129131

130132
for (const property of node.children) {
131-
yield property.children;
133+
if (property.children.length === 2) {
134+
yield property.children;
135+
}
132136
}
133137
};
134138

0 commit comments

Comments
 (0)