Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In this example, you will be given a readable stream, `counter`, as the first
- argument to your program:
- module.exports = function (counter) {
- // return a duplex stream to capture countries on the writable side
- // and pass through `counter` on the readable side
- };
- Return a duplex stream with the `counter` as the readable side. You will be
- written objects with a 2-character `country` field as input, such as these:
- {"short":"OH","name":"Ohio","country":"US"}
- {"name":"West Lothian","country":"GB","region":"Scotland"}
- {"short":"NSW","name":"New South Wales","country":"AU"}
- Create an object to keep a count of all the countries in the input. Once the
- input ends, call `counter.setCounts()` with your country counts.
- The `duplexer2` module will again be very handy in this example.
- If you use duplexer, make sure to `npm install duplexer2` in the directory where
- your solution file is located.
Advertisement
Add Comment
Please, Sign In to add comment