Checks whether or not a given path is a `bin` file.

@param {string} filePath - A file path to check.
@param {string|object|undefined} binField - A value of the `bin` field of `package.json`.
@param {string} basedir - A directory path that `package.json` exists.
@returns {boolean} `true` if the file is a `bin` file.
function isBinFile(filePath, binField, basedir) {
    if (!binField) {
        return false
    }
    if (typeof binField === "string") {
        return filePath === path.resolve(basedir, binField)
    }
    return Object.keys(binField).some(
        key => filePath === path.resolve(basedir, binField[key])
    )
}