7 ms·
Yes. If a person already knows JavaScript well, then it will be easier for them to write a CLI app/utility/script in JS than it would be to write a shell scrip
by akbar501 13y ago
Yes.
If a person already knows JavaScript well, then it will be easier for them to write a CLI app/utility/script in JS than it would be to write a shell script.
Another reason to write in JS would be to gain code reuse. If the person has a web app that uses node, then they can share code between the web and CLI applications.
- stock_toaster 13y ago> Another reason to write in JS would be to gain code reuse. > If the person has a web app that uses node, then they can > share code between the web and CLI applications. I often see this argument presented for just about any server side js. I often wonder about actual real world reuse though.
- daleharvey 13y agoLook at the top 2 depended on modules modules in the entire of the server side node.js ecosystem and guess what they were written for - https://npmjs.org/ https://npmjs.org/ I wrote a database specifically for web browsers and someone case along and write a relatively small pull request and it now works in node / on the server / with a http api - http://pouchdb.com http://pouchdb.com
- akbar501 13y agoI actually reuse the same code a lot, which is a very nice feature once you get used to it. I share code between the client and server. For example, I have data type checks where I reuse the same library and the same application specific code on both the client and server. I expose substantial portions of my server-side code via the command line. I also frequently call shell scripts from node as there are certain things I find easier to write in a shell script. That said, I don't know if this amount of reuse is typical. And, code reuse is clearly not the only consideration.