Guest User

Untitled

a guest
Mar 16th, 2015
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. In this example, you will be given a readable stream, `counter`, as the first
  2. argument to your program:
  3.  
  4. module.exports = function (counter) {
  5. // return a duplex stream to capture countries on the writable side
  6. // and pass through `counter` on the readable side
  7. };
  8.  
  9. Return a duplex stream with the `counter` as the readable side. You will be
  10. written objects with a 2-character `country` field as input, such as these:
  11.  
  12. {"short":"OH","name":"Ohio","country":"US"}
  13. {"name":"West Lothian","country":"GB","region":"Scotland"}
  14. {"short":"NSW","name":"New South Wales","country":"AU"}
  15.  
  16. Create an object to keep a count of all the countries in the input. Once the
  17. input ends, call `counter.setCounts()` with your country counts.
  18.  
  19. The `duplexer2` module will again be very handy in this example.
  20.  
  21. If you use duplexer, make sure to `npm install duplexer2` in the directory where
  22. your solution file is located.
Advertisement
Add Comment
Please, Sign In to add comment