Skip to content

Commit 20aafac

Browse files
committed
document the ugly, and comment on how to make it less so
1 parent 5535480 commit 20aafac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/jsonselect.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,12 @@
209209
}
210210
}
211211
if (m && cs.has) {
212+
// perhaps we should augment forEach to handle a return value
213+
// that indicates "client cancels traversal"?
214+
var bail = function() { throw 42; };
212215
for (var i = 0; i < cs.has.length; i++) {
213216
try {
214-
forEach(cs.has[i], node, function() {
215-
throw 42;
216-
});
217+
forEach(cs.has[i], node, bail);
217218
} catch (e) {
218219
if (e === 42) continue;
219220
}

0 commit comments

Comments
 (0)