const path = require('path')

const EVENT = process.env.npm_lifecycle_event || ''
const ROOT = path.resolve(__dirname, '..')

function hasProcessFlag(flag) {
  return process.argv.join('').indexOf(flag) > -1
}
function hasNpmFlag(flag) {
  return EVENT.includes(flag)
}
const root = path.join.bind(path, ROOT)

module.exports = {
  hasProcessFlag,
  hasNpmFlag,
  root
}
