How to use the matched.promise 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 / delete / index.js View on Github external
del.promise = function delPromise(patterns, options) {
  var opts = extend({cwd: process.cwd()}, options);
  var deleted = [];

  if (patterns === '' && isCurrentDir(opts.cwd)) {
    return Promise.resolve(deleted);
  }

  return glob.promise(patterns, opts)
    .then(function(files) {
      // sync is actually faster than async most of the time
      files.forEach(function(fp) {
        del.sync(fp, opts);
        deleted.push(fp);
      });
      return deleted;
    });
};
github TrySound / multi-entry-loader / index.js View on Github external
if (!include.length) {
        throw Error('include option should be specified');
    }

    const parents = include.reduce((list, pattern) => {
        const parent = globParent(pattern);
        if (list.indexOf(parent) === -1) {
            list.push(parent);
        }
        return list;
    }, []);

    parents.forEach(parent => this.addContextDependency(parent));

    return matched(patterns, { realpath: true }).then(combinePaths).then(code => done(null, code));
}
github redux-zero / redux-zero / src / build / multiEntries.js View on Github external
load(id) {
      if (id === entry) {
        if (!include.length) {
          return Promise.resolve('')
        }
        const patterns = include.concat(exclude.map(pattern => '!' + pattern))
        return matched(patterns, { realpath: true }).then(paths => paths.map(exporter).join('\n'))
      }
    }
  }
github rollup / rollup-plugin-multi-entry / src / index.js View on Github external
load(id: string): ?Promise {
      if (id === entry) {
        if (!include.length) {
          return Promise.resolve('');
        }
        const patterns = include.concat(exclude.map(pattern => '!' + pattern));
        return matched(patterns, { realpath: true }).then(paths =>
          paths.map(exporter).join('\n')
        );
      }
    }
  };
github fullcalendar / fullcalendar / rollup-plugin-multi-entry-array.js View on Github external
load(id) {
      if (id === entry) {
        if (!include.length) {
          return Promise.resolve('')
        }
        const patterns = include.concat(exclude.map(pattern => '!' + pattern))
        return matched(patterns, { realpath: true }).then(paths => {
          let s =
            paths.map((path, index) => `import _m${index} from ${JSON.stringify(path)}`).join(';\n') +
            ';\n' +
            'export default [\n' +
            paths.map((path, index) => `_m${index}`).join(', ') + '\n' +
            '];\n'
          return s
        })
      }
    }
  }

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