How to use now-and-later - 7 common examples

To help you get started, we’ve selected a few now-and-later 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 gulpjs / vinyl-sourcemap / lib / helpers.js View on Github external
function fixImportedSourceMap(file, state, callback) {
  if (!state.map) {
    return callback();
  }

  state.map.sourcesContent = state.map.sourcesContent || [];

  nal.map(state.map.sources, normalizeSourcesAndContent, callback);

  function assignSourcesContent(sourceContent, idx) {
    state.map.sourcesContent[idx] = sourceContent;
  }

  function normalizeSourcesAndContent(sourcePath, idx, cb) {
    var sourceRoot = state.map.sourceRoot || '';
    var sourceContent = state.map.sourcesContent[idx] || null;

    if (isRemoteSource(sourcePath)) {
      assignSourcesContent(sourceContent, idx);
      return cb();
    }

    if (state.map.sourcesContent[idx]) {
      return cb();
github gulpjs / bach / lib / parallel.js View on Github external
function parallel(done) {
    nowAndLater.map(args, iterator, extensions, done);
  }
github gulpjs / bach / lib / settleParallel.js View on Github external
function settleParallel(done) {
    var onSettled = helpers.onSettled(done);
    nowAndLater.map(args, iterator, extensions, onSettled);
  }
github VaJoy / BlogDemo2 / 170201 / bach / parallel.js View on Github external
function parallel(done) {
        //遍历tasks数组,将其生命周期和extensions属性关联起来,且将每个task异步化,且并发执行
        nowAndLater.map(args, asyncDone, extensions, done);
    }
github gulpjs / bach / lib / settleSeries.js View on Github external
function settleSeries(done) {
    var onSettled = helpers.onSettled(done);
    nowAndLater.mapSeries(args, iterator, extensions, onSettled);
  }
github gulpjs / bach / lib / series.js View on Github external
function series(done) {
    nowAndLater.mapSeries(args, iterator, extensions, done);
  }
github gulpjs / vinyl-sourcemap / lib / helpers.js View on Github external
function addSourceMaps(file, state, callback) {
  var tasks = [
    loadSourceMap,
    fixImportedSourceMap,
    mapsLoaded,
  ];

  function apply(fn, key, cb) {
    fn(file, state, cb);
  }

  nal.mapSeries(tasks, apply, done);

  function done() {
    callback(null, file);
  }
}

now-and-later

Map over an array or object of values in parallel or series, passing each through the async iterator, with optional lifecycle hooks.

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis

Popular now-and-later functions