jsparse icon indicating copy to clipboard operation
jsparse copied to clipboard

nodejs compatibility

Open rictic opened this issue 13 years ago • 1 comments

Hi!

I've been enjoying using jsparse, but I wanted to be able to test my parsers in nodejs, and figured it'd also be nice to have the option to put everything within its own namespace, so I hacked up this patch.

I haven't yet updated the examples, but tests.js passes (in 3ms! and ~100ms including startup time and everything), and I added a browser invocation of the tests.js code.

There are two backwards incompatible changes introduced. One is that to use it the old way (with everything in the toplevel namespace) in a browser you must call

jsparse.inject_into(window)

And even with that, memoize must be set on jsparse, it can't be set in the toplevel namespace.

Anyways, thanks for writing jsparse!

rictic avatar Feb 11 '12 22:02 rictic

Thanks for the pull request, I'll look at it tonight and merge.

doublec avatar Feb 13 '12 21:02 doublec