How to use the matched.sync function in matched

To help you get started, we’ve selected a few matched 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 jonschlinkert / resolve-dep / index.js View on Github external
resolveDep.local = function(patterns, options) {
  options = options || {};
  options.cwd = options.srcBase = cwd(options.cwd || process.cwd());
  patterns = arrayify(arrayify(patterns));
  if (!patterns.length) {
    return [];
  }
  // find local matches
  return glob.sync(patterns, options).map(function(filepath) {
    return lookup(filepath, options.cwd);
  });
};
github jonschlinkert / template / test / loaders.js View on Github external
return Promise.method(function (patterns, opts) {
          return glob.sync(patterns, opts);
        });
      });
github jonschlinkert / merge-configs / index.js View on Github external
resolve(type) {
    const config = this.type(type);
    const files = glob.sync(config.patterns, config.options);
    const cwd = config.options.cwd;
    const res = [];

    for (let filename of files) {
      const filepath = path.resolve(cwd, filename);
      const file = new File({path: filepath, cwd: cwd});
      if (typeof config.filter === 'function') {
        if (config.filter(file) === false) {
          continue;
        }
      }
      res.push(file);
    }
    return res;
  }
github jonschlinkert / gray-matter / benchmark / support.js View on Github external
function files(cwd, patterns, opts) {
  return glob.sync(path.join(cwd, patterns), opts);
}
github ContentMine / getpapers / lib / eupmc.js View on Github external
EuPmc.prototype.summariseMinedTerms = function () {
  log.info('Writing mined term summary CSV files to minedterms_summary/')
  mkdirp.sync('minedterms_summary')
  var termstore = {}
  glob.sync(['*/textMinedTerms.json']).forEach(function (termsFile) {
    var json = fs.readFileSync(termsFile, 'utf8')
    var terms = JSON.parse(json)
    terms.semanticTypeList.semanticType.forEach(function (termset) {
      if (!termstore[termset.name]) {
        termstore[termset.name] = []
      }
      var rows = termset.tmSummary.map(function (term) {
        return [
          terms.request.id,
          '"' + term.term + '"',
          term.count,
          term.dbname,
          term.dbIdList.dbId.join(';')
        ]
      })
      termstore[termset.name] = termstore[termset.name].concat(rows)
github jonschlinkert / get-value / benchmark / check.js View on Github external
function files(base, pattern) {
  return glob.sync(toGlob(base, pattern));
}
github todogroup / repolinter / lib / file_system.js View on Github external
glob (globs, options) {
    return glob.sync(globs, options)
      .filter(relativePath => this.shouldInclude(relativePath))
  }
github jonschlinkert / load-templates / index.js View on Github external
globViews(patterns, options) {
    patterns = utils.arrayify(patterns);
    const opts = Object.assign({ cwd: process.cwd() }, this.options, options);
    delete opts.nonull;

    for (let i = 0; i < patterns.length; i++) {
      const pattern = patterns[i];
      const is = isGlob(pattern);

      let files = is ? glob.sync(pattern, opts) : [];
      if (files.length === 0) {
        files = !is ? [pattern] : [];
      } else {
        files = files.map(f => path.resolve(opts.cwd, f));
      }

      if (files.length) {
        const parent = path.resolve(is ? globParent(pattern) : '.');
        const base = path.resolve(opts.cwd, parent);
        this.addViews(files, Object.assign({}, options, { base: base }));
      }
    }
    return this.cache;
  }

matched

Adds array support to node-glob, sync and async. Also supports tilde expansion (user home) and resolving to global npm modules.

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis

Popular matched functions