UNPKG

lbl

Version:

Process stdin, line by line, sort of like AWK but 100% JS

21 lines (19 loc) 320 B
'use strict'; /* global $, log, chalk, n:true, f:true */ module.exports = { each: x => { n++; if (x.match(/^X/)) { log(chalk.yellow('> ') + x); f++; } }, before: () => { $.n = 0; $.f = 0; log('<<BEGIN>>'); }, after: () => { log('> Matched ' + f + ' from ' + n); } };