0.1.2 • Published 11 years ago

mapline v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
11 years ago

mapline

map a stream line by line

This module reads a stream line by line, mapping a function on them. function is called with null on the last iteration.

example

require('mapline')(function(line){if(line) console.log('_'+line);});
$ (echo a; echo b) | node -e "require('mapline')(function(line){if (line)console.log('_'+line);})"
_a
_b

methods

var mapline = require('mapline')

mapline(fn)

mapline(rs, fn)

Returns a function that applies fn to each line of input text.

Optional rs defaults to process.stdin.

install

With npm do:

npm install mapline

license

MIT