-
Notifications
You must be signed in to change notification settings - Fork 78
Description
As previously reported with a documentation clarification (see #46).
It seems to me that API usability would be improved by eliminating this special case, such that openobject only signifies the start of an object and key events be raised exactly once for every key without exceptions, starting in a v1.0 release (simultaneously committing to full and meaningful semver compliance). However I would appreciate feedback from @dscape as well as current maintainers of other dependent public packages.
Alternatively it might be nice to offer some more detailed usage guidance including coverage of edge cases. Here's an excerpt from a module I wrote—using clarinet and convertings its output to a top-level object/array stream—where I internally capture and normalize the current behavior:
function setKey(key) {
// update current key
}
sax.onkey = setKey;
sax.onopenobject = function(key) {
// track object creation
if(key !== undefined) setKey(key);
}