How to use the neo-async.parallel function in neo-async

To help you get started, we’ve selected a few neo-async 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 fossasia / susper.com / node_modules / cache-loader / dist / index.js View on Github external
if (mtime / 1000 >= Math.floor(data.startTime / 1000)) {
        // Don't trust mtime.
        // File was changed while compiling
        // or it could be an inaccurate filesystem.
        cache = false;
      }

      mapCallback(null, {
        path: dep,
        mtime
      });
    });
  };

  async.parallel([function (cb) {
    return async.mapLimit(dependencies, 20, toDepDetails, cb);
  }, function (cb) {
    return async.mapLimit(contextDependencies, 20, toDepDetails, cb);
  }], function (err, taskResults) {
    if (err) {
      callback.apply(undefined, [null].concat(args));
      return;
    }
    if (!cache) {
      callback.apply(undefined, [null].concat(args));
      return;
    }

    var _taskResults = _slicedToArray(taskResults, 2),
        deps = _taskResults[0],
        contextDeps = _taskResults[1];
github goFrendiAsgard / chimera-framework / web / helper.js View on Github external
async.parallel(dbActions, (error, result) => {
    if (error) {
      return callback(error, state)
    }
    // render configuration from database
    let configActions = []
    for (let doc of configDocs) {
      if (state.config.exceptionKeys.indexOf(doc.key) === -1) {
        configActions.push((next) => {
          state.config[doc.key] = renderConfigValue(doc, state.config)
          next()
        })
      }
    }
    return async.parallel(configActions, (error, result) => {
      if (error) {
        return callback(error, state)
      }
      state.config.exceptionKeys = []
      state.config.middlewares = []
      state.config.vars = []
      let routeActions = []
      // render routes
      for (let route in state.config.routes) {
        routeActions.push((next) => {
          route = renderRoute(route, state.config)
          next()
        })
      }
      // add rendered cck routes
      let cckRoutes = cck.getRoutes()
github goFrendiAsgard / chimera-framework / web / helper.js View on Github external
let configDocs, routeDocs
  let dbActions = [
    (next) => {
      mongoExecute('web_configs', 'find', {}, (error, docs) => {
        configDocs = docs
        next(error, docs)
      })
    },
    (next) => {
      mongoExecute('web_routes', 'find', {}, (error, docs) => {
        routeDocs = docs
        next(error, docs)
      })
    }
  ]
  async.parallel(dbActions, (error, result) => {
    if (error) {
      return callback(error, state)
    }
    // render configuration from database
    let configActions = []
    for (let doc of configDocs) {
      if (state.config.exceptionKeys.indexOf(doc.key) === -1) {
        configActions.push((next) => {
          state.config[doc.key] = renderConfigValue(doc, state.config)
          next()
        })
      }
    }
    return async.parallel(configActions, (error, result) => {
      if (error) {
        return callback(error, state)
github liquidcarrot / carrot / test / example.step-by-step.js View on Github external
"connections": function(callback) {
          async.parallel([
            function(callback) { 
              i1.connect(h1, 0.15, function(error, connection) {
                expect(error).to.be.null
                expect(connection).to.be.an.instanceOf(Connection)
                expect(connection.from).to.eql(i1)
                expect(connection.to).to.eql(h1)
                expect(connection.weight).to.equal(0.15)
                expect(connection.forward.queue).to.be.empty
                expect(connection.forward.states).to.be.empty
                expect(connection.backward.queue).to.be.empty
                expect(connection.backward.states).to.be.empty
                callback(error, connection)
              }) 
            },
            function(callback) { 
              i2.connect(h1, 0.2, function(error, connection) {
github lambci / lambci / utils / log.js View on Github external
function updateS3Branch(build, bucket, key, branchKey, branchStatusKey, makePublic, cb) {
  if (build.eventType != 'push') return cb()

  var svgKey = {
    pending: 'pending',
    success: 'passing',
    failure: 'failing',
  }
  var svgBody = SVGS[svgKey[build.status]] || SVGS.pending

  async.parallel([
    function copyBuildLogToBranch(cb) {
      s3.copyObject({
        Bucket: bucket,
        CopySource: `${bucket}/${key}`,
        Key: branchKey,
        ContentType: 'text/html; charset=utf-8',
        ACL: makePublic ? 'public-read' : undefined,
      }, cb)
    },
    function uploadSvgStatus(cb) {
      s3.upload({
        Bucket: bucket,
        Key: branchStatusKey,
        ContentType: 'image/svg+xml; charset=utf-8',
        CacheControl: 'no-cache',
        Body: svgBody,
github goFrendiAsgard / chimera-framework / web / cck.js View on Github external
function getSingleData (request, fieldNames, config, callback) {
  let uploadPath = getUploadPath(config)
  let rawData = util.getPatchedObject(request.query, request.body)
  let rawFiles = request.files
  let {data, actions} = getPreprocessedSingleData (rawData, rawFiles, fieldNames, config)
  return async.parallel(actions, (error, result) => {
    callback(error, data)
  })
}
github goFrendiAsgard / chimera-framework / web / plugin.js View on Github external
function createPluginSpecialDirectories (pluginName, callback) {
  let actions = []
  for (let directory of specialDirectories) {
    let dst = getPluginSpecialDirectory(pluginName, directory)
    actions.push((next) => {
      fse.ensureDir(dst, next)
    })
  }
  async.parallel(actions, callback)
}
github suguru03 / func-comparator / sample / async / sample.parallel.js View on Github external
'neo-async': function(callback) {
    neo_async.parallel(tasks, callback);
  }
};
github goFrendiAsgard / chimera-framework / web / plugin.js View on Github external
function createCmsDirectory (pluginName, callback) {
  let actions = []
  for (let directory of specialDirectories) {
    let src = getNodeModuleSpecialDirectory(pluginName, directory)
    actions.push((next) => {
      fse.pathExists(src, (error, exists) => {
        if (error || !exists) { return next (error)}
        let dst = getCmsSpecialDirectory(pluginName, directory)
        return fse.copy(src, dst, next)
      })
    })
  }
  async.parallel(actions, callback)
}
github goFrendiAsgard / chimera-framework / web / cck.js View on Github external
if (util.isArray(document)) {
    let actions = []
    let newDocument = []
    for (let i = 0; i < document.length; i++) {
      let row = document[i]
      actions.push((next) => {
        getShownSingleDocument(row, allowedFieldNames, (error, newRow) => {
          if (error) {
            return next(error)
          }
          newDocument[i] = newRow
          return next(null, newRow)
        })
      })
    }
    return async.parallel(actions, (error, result) => {
      return callback(error, newDocument)
    })
  }
  return getShownSingleDocument(document, allowedFieldNames, callback)
}