In item #4 (json parsing / serializing), I mistakenly had a str.split() instead of str.split('\n') which made a rather difficult error message.
browserify » node_modules/.bin/browserify multi-export.js | node_modules/.bin/browserify-adventure run
INPUT: "{\"beep\":\"boop\"}\n[3,4,5]\n{\"x\":4,\"y\":5}"
undefined:2
[3,4,5]
^
SyntaxError: Unexpected token [
at Object.parse (native)
at Object.exports.parse (eval at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:9), <anonymous>:16:19)
at Object../ndjson (eval at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:9), <anonymous>:8:20)
at s (eval at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:9), <anonymous>:2:220)
at e (eval at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:9), <anonymous>:2:391)
at eval (eval at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:9), <anonymous>:2:409)
at run (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:90:56)
at /Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/problems/multi_export/index.js:60:9
at ConcatStream.<anonymous> (/Users/justinlilly/src/hacks/adventures/browserify/node_modules/browserify-adventure/node_modules/concat-stream/index.js:32:43)
at ConcatStream.EventEmitter.emit (events.js:117:20)
The key here is that the invisible character \n is obscured with an actual newline, which made it difficult to discern the actual error. Escaping it somehow would make that much easier.
In item #4 (json parsing / serializing), I mistakenly had a
str.split()instead ofstr.split('\n')which made a rather difficult error message.The key here is that the invisible character
\nis obscured with an actual newline, which made it difficult to discern the actual error. Escaping it somehow would make that much easier.