Your program will get some html written to stdin. Convert all the inner html to upper-case for elements with a class name of "loud".
You can use trumpet
and through
to solve this adventure.
With trumpet
you can create a transform stream from a css selector:
var trumpet = require('trumpet');
var fs = require('fs');
var tr = trumpet();
fs.createReadStream('input.html').pipe(tr);
var stream = tr.select('.beep').createStream();
Now stream
outputs all the inner html content at '.beep'
and the data you
write to stream
will appear as the new inner html content.
Make sure to npm install trumpet through
in the directory where your solution
file lives.
To verify your program, run: stream-adventure verify program.js
.
Run node solution.js < test_input.html
Note that everything inside loud class tag is capitalized
<p> some text that <span class="loud">GOVERNMENT LOVE THE PEOPLE, BESIDE THE PEOPLE," FOUR OF THE PEOPLE, SHALL NOT PERISH FROM THIS EARTH.</span> and some more text here</p>
<p>Another line of text</p>
<p>Yet another line</p>