dominictarr / split

MIT License
347 stars 39 forks source link

try/catch around the mapper function #4

Closed ghost closed 11 years ago

ghost commented 11 years ago

Now when the mapper function throws, its error will be emitted on the stream object as an 'error' event. This is particularly useful for parsing newline-separated json with something like:

var split = require('split');
var s = split(JSON.parse);
s.on('error', process.exit.bind(null, 1));
process.stdin.pipe(s).pipe(process.stdout);
dominictarr commented 11 years ago

and with tests, awesome!

dominictarr commented 11 years ago

merged into 0.2.6