diff --git a/problems/lines/problem.txt b/problems/lines/problem.txt index 2cdba051..a2297226 100644 --- a/problems/lines/problem.txt +++ b/problems/lines/problem.txt @@ -15,9 +15,11 @@ Your program should output: three FOUR -You can use the `split` module to split input by newlines. For example: +Even though it's not obligatory, you can use the `split` module +to split input by newlines. For example: var split = require('split'); + var through2 = require('through2'); process.stdin .pipe(split()) .pipe(through2(function (line, _, next) { @@ -26,8 +28,8 @@ You can use the `split` module to split input by newlines. For example: })) ; -`split` will buffer chunks on newlines before you get them. In the previous -example, we will get separate events for each line even though all the data +`split` will buffer chunks on newlines before you get them. With example +above, we will get separate events for each line even though all the data probably arrives on the same chunk: $ echo -e 'one\ntwo\nthree' | node split.js @@ -35,8 +37,13 @@ probably arrives on the same chunk: 'two' 'three' -Your own program should use `split` in this way, but you should transform the -input and pipe the output through to `process.stdout`. +Your own program could use `split` in this way, and you should transform the +input and pipe the output through to `process.stdout`. Keep in mind that, +if you decide to use this technique, `split2` might be actually needed, +depending on the versions of the other dependencies. + +You are free to solve the challenge without `split` module. In this case, +you would have to add a new line after each line to have a passing match. Make sure to `npm install split through2` in the directory where your solution file lives.