pkg-bin
Get a command name from a package.json object
const pkgBin = ; const pakcageJson = name: 'my-tool-cli' bin: 'my-tool': 'lib/cli.js' ; ; //=> 'my-tool'
Installation
npm install pkg-bin
API
const pkgBin = ;
pkgBin(pkgData)
pkgData: Object
(package.json object)
Return: String
(a command name)
It returns a command name of the given package.
; //=> 'hi'
If the package includes multiple commands, it returns the first one.
; //=> 'hello1'
If the package includes no commands, it returns null
.
; //=> null