1const checkBin = require('./check-bin.js')
2const normalize = require('npm-normalize-package-bin')
3const checkBins = async ({ pkg, path, top, global, force }) => {
4  // always ok to clobber when forced
5  // always ok to clobber local bins, or when forced
6  if (force || !global || !top) {
7    return
8  }
9
10  pkg = normalize(pkg)
11  if (!pkg.bin) {
12    return
13  }
14
15  await Promise.all(Object.keys(pkg.bin)
16    .map(bin => checkBin({ bin, path, top, global, force })))
17}
18module.exports = checkBins
19