How to use the glob.Glob.prototype function in glob

To help you get started, we’ve selected a few glob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / src / commands / dev / lib / glob.ts View on Github external
GlobIgnore.prototype._readdir = function _readdir(
  abs: string,
  inGlobStar: boolean,
  cb: GlobCallback
) {
  const marked = this._mark(abs);
  const rel = relative(this.cwd, marked);

  if (rel && this[IGNORE] && this[IGNORE](rel)) {
    return cb(null);
  }

  // @ts-ignore
  Glob.prototype._readdir.call(
    this,
    abs,
    inGlobStar,
    (err: Error, results?: string[]): void => {
      if (err) return cb(err);
      cb(
        null,
        results && results.filter(r => !(this[IGNORE] && this[IGNORE](r)))
      );
    }
  );
};