UNPKG

sifttt

Version:

Create simple recipes to do simple tasks, using gulp.

39 lines (28 loc) 633 B
'use strict'; /** * Create a codec method that: * * 1. splits the source into multiple lines; * 2. drops a specified number of lines; * 3. drops blank lines; * 4. returns the line as a string on a property of a JSON oject. */ module.exports = opts => s => s /** * Split the input to a line at a time: */ .split() /** * Drop the specified number of rows: */ .drop((opts && opts.drop) || 0) /** * Remove any blank lines. This is handy when there are trailing new lines: */ .filter(row => row !== '') /** * Place each row in an object: */ .map(row => ({message: row})) ;