How to use the neo-async.each 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 validitylabs / hopr / src / network / heartbeat.js View on Github external
module.exports = (node) => setInterval(() => 
    each(node.peerBook.getAllArray(), (peerInfo, cb) => {
        if (
            // node was in the list when last round of heartbeat started
            // make sure that it is still here
            !node.peerBook.getAll()[peerInfo.id.toB58String()] ||
            // check whether node was seen recently
            Date.now() - (node.peerBook.getAll()[peerInfo.id.toB58String()].lastSeen || 0) <= THIRTY_ONE_SECONDS
        )
            return cb()

        waterfall([
            (cb) => {
                if (!peerInfo.isConnected() || peerInfo.multiaddrs.size < 1)
                    return node.peerRouting.findPeer(peerInfo.id, cb)

                cb(null, peerInfo)
            },
github fossasia / susper.com / node_modules / cache-loader / dist / index.js View on Github external
readFn(data.cacheKey, function (readErr, cacheData) {
    if (readErr) {
      callback();
      return;
    }
    if (cacheData.remainingRequest !== remainingRequest) {
      // in case of a hash conflict
      callback();
      return;
    }
    var FS = _this.fs || fs;
    async.each(cacheData.dependencies.concat(cacheData.contextDependencies), function (dep, eachCallback) {
      FS.stat(dep.path, function (statErr, stats) {
        if (statErr) {
          eachCallback(statErr);
          return;
        }
        if (stats.mtime.getTime() !== dep.mtime) {
          eachCallback(true);
          return;
        }
        eachCallback();
      });
    }, function (err) {
      if (err) {
        data.startTime = Date.now();
        callback();
        return;
github liquidcarrot / carrot / src / assumptions.0.working.js View on Github external
"weights": function(callback) {
        
        async.each(self.connections.incoming, function(connection, callback) {
          connection.weight = connection.weight - random.scale() * random.scale() * random.scale()
          callback()
        }, callback)
        
        // Passes reference to iteratee
        /*
        async.each(self.connections.incoming, function(connection, callback) {
          connection.weight = connection.weight - random.scale() * random.scale() * random.scale()
          callback()
        }, callback)
        */
        
        // Passes reference to iteratee (another option)
        /*
        async.times(self.connections.incoming.length, function(index, callback) {
          self.connections.incoming[index].weight = self.connections.incoming[index].weight - random.scale() * random.scale() * random.scale()
github antwarjs / antwar / packages / antwar / src / build / worker.js View on Github external
module.exports = function writePages(
  { configurationPaths, environment, pages, outputPath, templates },
  finalCb
) {
  const antwarConfiguration = mergeConfiguration(
    defaultAntwar(),
    require(configurationPaths.antwar)(environment)
  );

  async.each(
    pages,
    ({ page, path }, cb) =>
      processPage(
        {
          configurationPaths,
          antwarConfiguration,
          page,
          path,
          outputPath,
          templates,
        },
        cb
      ),
    finalCb
  );
};
github linitix / nzero-push / lib / endpoints / register_endpoint.js View on Github external
function (deviceToken, next) {
      debug("Registering device token: " + deviceToken);

      async.each(
        channels,
        function (channel, next) {
          debug("For channel: " + channel);

          self.requestsManager.register(deviceToken, channel, function (err) {
            if ( err )
              data.unregistered.push({ device_token: deviceToken, channel: channel, error: err });
            else
              data.registered.push({ device_token: deviceToken, channel: channel });

            next();
          });
        },
        function (err) { next(err); }
      );
    },
github linitix / nzero-push / lib / endpoints / register_endpoint.js View on Github external
function registerDeviceTokens(deviceTokens, callback, self) {
  var data = {
    registered  : [],
    unregistered: []
  };

  async.each(
    deviceTokens,
    function (deviceToken, next) {
      debug("Registering device token: " + deviceToken);

      self.requestsManager.register(deviceToken, null, function (err) {
        if ( err )
          data.unregistered.push({ device_token: deviceToken, error: err });
        else
          data.registered.push({ device_token: deviceToken });

        next();
      });
    },
    function (err) { callback(err, data); }
  );
}
github mcollina / fastparallel / bench.js View on Github external
function benchNeoEach (done) {
  neo.each([1, 2, 3], somethingP, done)
}
github suguru03 / func-comparator / sample / async / sample.map.js View on Github external
'neo-async': function(callback) {
    c = 0;
    neo_async.each(array, iterator, callback);
  }
};
github suguru03 / neo-async / perf / func-comparator / collections / sample.each.js View on Github external
'neo-async_v0': function(callback) {
    neo_async_v0.each(array, iterator, callback);
  },
  'neo-async_v1': function(callback) {