lib/util.js
function globFile (file) {
    return stat(file).then(({ err, stats }) => {
      if (err) throw err
      if (stats.isDirectory()) {
        // TODO what if file is already slash-terminated?
        switch (file) {
          case './':
            return globPromise('./*.js')
          case 'bin':
            return globPromise('bin/*')
          default:
            return globPromise(`${file}/**/*.js`)
        }
      } else {
        return Promise.resolve(file)
      }
    })
  }
function globFile (file) {
    return stat(file).then(({ err, stats }) => {
      if (err) throw err
      if (stats.isDirectory()) {
        // TODO what if file is already slash-terminated?
        switch (file) {
          case './':
            return globPromise('./*.js')
          case 'bin':
            return globPromise('bin/*')
          default:
            return globPromise(`${file}/**/*.js`)
        }
      } else {
        return Promise.resolve(file)
      }
    })
  }
function globFile ( file ) { return stat ( file ) . then ( ( { err , stats } ) => { if ( err ) throw err if ( stats . isDirectory ( ) ) { // TODO what if file is already slash-terminated? switch ( file ) { case './' : return globPromise ( './*.js' ) case 'bin' : return globPromise ( 'bin/*' ) default : return globPromise ( ` ${ file } ` ) } } else { return Promise . resolve ( file ) } } ) }
Glob a path.
If the path is a file, return the path
If the path is a directory, return the promisified glob of the directory
Throw an error if the path does no exist
Glob a path . If the path is a file return the path If the path is a directory return the promisified glob of the directory Throw an error if the path does no exist