Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 931 Bytes

README.md

File metadata and controls

43 lines (27 loc) · 931 Bytes

has-command

MIT License

Check if a binary exists in your system PATH.

Features

  • Fully compatible with TypeScript.
  • 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-command

Examples

ES modules

import { hasCommand } from 'has-command';

console.log(await hasCommand('cd')); // true
console.log(await hasCommand('nonexistent_command')); // false

CommonJS

const { hasCommand } = require('has-command');

console.log(await hasCommand('cd')); // true
console.log(await hasCommand('nonexistent_command')); // false

License

MIT