New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cmdexist

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmdexist

The cross-platform and super-fast library which can check if a command or even the commands bundle exist.

latest
npmnpm
Version
1.1.1
Version published
Weekly downloads
8
700%
Maintainers
1
Weekly downloads
 
Created
Source

cmdexist

The cross-platform and super-fast library which can check if a command or even the commands bundle exist.

It should be compatible with Node v10+.

Usage

npm i cmdexist
yarn add cmdexist # or if you use yarn
/* SINGLE FILE TO TEST */
function singleFileToTest() {
  CheckIfExist("node").then((exec) => console.log(`node is ${exec}`));
}

/* MULTIPLE FILES TO TEST */
async function multipleFilesToTest() {
  // Set as `const` so TypeScript will correctly show the entries in toCheck array.
  const toCheck = ["npm", "node", "yarn", "python", "docker"] as const;
  const [result, details] = await CheckIfAllExist(toCheck);

  details; // We can see that it shows the every entries in `toCheck`.
  console.log(result);
  console.log(details);
}

For more information, See the docs and examples/ folder.

Benchmarks

See benchmarks/command-exists.ts.

commandExists - when the exe exists: 12.467ms
commandExists - when the exe not exists: 6.156ms
[our] cmdexist - when the exe exists: 0.92ms
[our] cmdexist - when the exe not exists: 0.301ms

Authors

  • pan93412 <pan93412@gmail.com>, 2021.

FAQs

Package last updated on 05 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts