Javascript solution to Coding Challenges first challenge: build your own wc tool
chmod +x ./cmd/ccwc/cli.jsThe command is now executable and can be executed globally by
npm linkNote that the alias for the command is on package.json and you can only use
ccwc [options] [filename]Unit Tests
npm testjs-ccwc-tool % wc -c test.txt
342190 test.txt
js-ccwc-tool % ccwc -c test.txt
342190 test.txtjs-ccwc-tool % wc -l test.txt
7146 test.txt
js-ccwc-tool % ccwc -l test.txt
7146 test.txtjs-ccwc-tool % wc -w test.txt
58164 test.txt
js-ccwc-tool % ccwc -w test.txt
58164 test.txtjs-ccwc-tool % wc -m test.txt
339292 test.txt
js-ccwc-tool % ccwc -m test.txt
339292 test.txtjs-ccwc-tool % wc test.txt
7146 58164 342190 test.txt
js-ccwc-tool % ccwc test.txt
7146 58164 342190 test.txtjs-ccwc-tool % cat test.txt | wc -l
7146
js-ccwc-tool % cat test.txt | ccwc -l
7146