code: function glob(pattern, options, cb) {
    if (typeof options === 'function') {
      cb = options;
      options = {};
    }
  
    if (Array.isArray(pattern)) {
      return glob.each.apply(glob, arguments);
    }
  
    if (typeof cb !== 'function') {
      if (typeof cb !== 'undefined') {
        throw new TypeError('expected callback to be a function');
      }
      return glob.promise.apply(glob, arguments);
    }
  
    if (typeof pattern !== 'string') {
      cb(new TypeError('expected glob to be a string or array'));
      return;
    }
  
    var opts = createOptions(pattern, options);
    bash(pattern, opts, function(err, files) {
      if (err instanceof Error) {
        cb(err);
        return;
      }
  
      if (!files) {
        files = err;
      }
  
      if (opts.nullglob === true && Array.isArray(files) && !files.length) {
        files = [pattern];
      }
  
      glob.emit('files', files, opts.cwd);
  
      if (!opts.each) {
        glob.end(files);
      }
  
      cb(null, files);
    });
  
    return glob;
  }
docs: Asynchronously returns an array of files that match the given pattern
  or patterns.
  
  ```js
  var glob = require('bash-glob');
  glob('*.js', function(err, files) {
  if (err) return console.log(err);
  console.log(files);
  });
  ```
  @param {String|Array} `patterns` One or more glob patterns to use for matching.
  @param {Object} `options` Options to pass to bash. See available [options](#options).
  @param {Function} `cb` Callback function, with `err` and `files` array.
  @api public