command-exists
command-exists copied to clipboard
commandExists should return boolean instead of rejecting
Unless there was an error with checking if the command exists. It would make more sense and be more idiomatic to have a resolve(true/false) rather than rejecting in the case of the command not existing. This also means you can use async/await syntax: const exists = await commandExists('the-command')
In addition this currently throw null as an error. Which if not handled locally, will tell absolutely nothing when caught in general error handler.
Thanks @vihanb @Huulivoide. I don't have time to implement this change at the moment, but would accept a PR for it.
You can check my fork that does what you want : https://github.com/raftario/command-exists The changes were too significant for me to open a PR, and it's not compatible with Node <6, so I decided to publish it as a separate module.