mirror of
https://github.com/pnpm/pnpm.git
synced 2026-02-03 03:33:21 -05:00
Use lebab to transpile ES5 code to ES6. Use eslint to fix styling issues afterwards. Run all js in strict mode to allow let/const in Node 4.
24 lines
486 B
JavaScript
24 lines
486 B
JavaScript
'use strict'
|
|
module.exports = binify
|
|
|
|
/*
|
|
* Returns bins for a package in a standard object format. This normalizes
|
|
* between npm's string and object formats.
|
|
*
|
|
* binify({ name: 'rimraf', bin: 'cmd.js' })
|
|
* => { rimraf: 'cmd.js' }
|
|
*
|
|
* binify({ name: 'rmrf', bin: { rmrf: 'cmd.js' } })
|
|
* => { rmrf: 'cmd.js' }
|
|
*/
|
|
|
|
function binify (pkg) {
|
|
if (typeof pkg.bin === 'string') {
|
|
const obj = {}
|
|
obj[pkg.name] = pkg.bin
|
|
return obj
|
|
}
|
|
|
|
return pkg.bin || {}
|
|
}
|