has-command
v1.0.1
Published
[](https://choosealicense.com/licenses/mit/)
Maintainers
Readme
has-command
Check if a binary exists in your system PATH.
Features
- [x] Fully compatible with TypeScript.
- [x] Supports both ESM (ES Modules) and CommonJS module systems.
Installation
Replace and execute the command according to the package manager you are using. Here is an example of npm.
npm install --save-dev has-commandExamples
ES modules
import { hasCommand } from 'has-command';
console.log(await hasCommand('cd')); // true
console.log(await hasCommand('nonexistent_command')); // falseCommonJS
const { hasCommand } = require('has-command');
console.log(await hasCommand('cd')); // true
console.log(await hasCommand('nonexistent_command')); // false