Package Exports
- hasbin
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hasbin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
HasBin
Check whether a binary exists in the PATH
environment variable.
var hasbin = require('hasbin');
// Check if a binary exists
hasbin('node', function (result) {
// result === true
});
hasbin('wtf', function (result) {
// result === false
});
// Check if all binaries exist
hasbin.all(['node', 'npm'], function (result) {
// result === true
});
// Check if at least one binary exists
hasbin.some(['node', 'wtf'], function (result) {
// result === true
});
Table Of Contents
Install
Install HasBin with npm:
npm install hasbin
Usage
hasbin(binaryName, callback)
Check whether a binary exists on one of the paths in process.env.PATH
. Calls back with true
if it does.
// Arguments
binaryName = String
callback = Function(Boolean)
// Example
hasbin('node', function (result) {
// result === true
});
hasbin.sync(binaryName)
Synchronous hasbin
.
// Arguments
binaryName = String
return Boolean
// Example
result = hasbin.sync('node');
hasbin.all(binaryNames, callback)
Check whether all of a set of binaries exist on one of the paths in process.env.PATH
. Calls back with true
if all of the binaries do. Aliased as hasbin.every
.
// Arguments
binaryNames = Array(String)
callback = Function(Boolean)
// Example
hasbin.all(['node', 'npm'], function (result) {
// result === true
});
hasbin.all.sync(binaryNames)
Synchronous hasbin.all
. Aliased as hasbin.every.sync
.
// Arguments
binaryNames = Array(String)
return Boolean
// Example
result = hasbin.all.sync(['node', 'npm']);
hasbin.some(binaryNames, callback)
Check whether at least one of a set of binaries exists on one of the paths in process.env.PATH
. Calls back with true
if at least one of the binaries does. Aliased as hasbin.any
.
// Arguments
binaryNames = Array(String)
callback = Function(Boolean)
// Example
hasbin.some(['node', 'npm'], function (result) {
// result === true
});
hasbin.some.sync(binaryNames)
Synchronous hasbin.some
. Aliased as hasbin.any.sync
.
// Arguments
binaryNames = Array(String)
return Boolean
// Example
result = hasbin.some.sync(['node', 'npm']);
Contributing
To contribute to HasBin, clone this repo locally and commit your code on a separate branch.
Please write unit tests for your code, and check that everything works by running the following before opening a pull-request:
make ci
License
HasBin is licensed under the MIT license.
Copyright © 2015, Nature Publishing Group