How to use neo-async - 10 common examples

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 / crawl.js View on Github external
doWhilst((cb) => {
        if (nodes.length === 0)
            return cb(Error('Unable to find enough other nodes in the network.'))

        selected = randomSubset(nodes, Math.min(nodes.length, MAX_HOPS))
        nodes = pullAll(nodes, selected)

        map(selected, queryNode, (err, newNodes) => {
            if (err) {
                console.log(err)
                return cb(err)
            }

            newNodes = uniqWith(flatten(newNodes), (a, b) => a.isEqual(b))

            nodes.push(...newNodes.map((peerId) => peerId.toB58String()))

            log(node.peerInfo.id, `Received ${newNodes.length} new node${newNodes.length === 1 ? '' : 's'}.`)
            log(node.peerInfo.id, `Now holding peer information of ${node.peerBook.getAllArray().length} node${node.peerBook.getAllArray().length === 1 ? '' : 's'} in the network.`)
            // log(node.peerInfo.id, node.peerBook.getAllArray().reduce((acc, peerInfo) => {
            //     return acc.concat(`PeerId ${peerInfo.id.toB58String()}, available under ${peerInfo.multiaddrs.toArray().join(', ')}`)
            // }, ''))

            return cb()
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 soomtong / blititor / module / notice / lib / database.js View on Github external
console.log('   inserted records...', result.insertId);

                        callback(null, result);
                    });
                };
                const resultAsync = function (err, result) {
                    console.log(' = Inserted default records...');

                    // for async
                    done && done(err, result);

                    // close connection
                    connection.destroy();
                };

                async.mapSeries(dummy, iteratorAsync, resultAsync);
            });
        }
github soomtong / blititor / module / app_store / lib / database.js View on Github external
callback(null, result);
                });
            };

            var resultAsync = function (err, result) {
                console.log(' = Inserted category records...');

                // for async
                done && done(err, result);

                // close connection
                connection.destroy();
            };

            async.mapSeries(dummy, iteratorAsync, resultAsync);
        }
    });
}
github IBM / ipfs-social-proof / src / remote-proofs.js View on Github external
if (!Array.isArray(proofArray) || !proofArray.length) {
      throw new Error('proofArray is a required argument')
    }

    async function process (item, callback) {
      // setTimeout(() => {
        // slow this down due to rate limits?
        return await that.processProofUrl(item.url,
                                          item.username,
                                          item.service,
                                          item,
                                          callback)
      // }, 250)
    }

    async.mapSeries(proofArray, process, (err, results) => {
      if (err) {
        console.error(err)
        return callback(err, results)
      }
      return callback(null, results)
    })
  }
}
github soomtong / blititor / module / teamblog / lib / database.js View on Github external
callback(err, result);
                    });
                };

                var resultAsync = function (err, result) {
                    console.log(' = Inserted default records...');

                    // for async
                    done && done(err, result);

                    // close connection
                    connection.destroy();
                };

                async.mapSeries(dummy, iteratorAsync, resultAsync);
            });
        }
github soomtong / blititor / module / reservation / lib / database.js View on Github external
console.log('   inserted records...', result.insertId);

                    callback(null, result);
                });
            };
            const resultAsync = function (err, result) {
                console.log(' = Inserted default records...');

                // for async
                done && done(err, result);

                // close connection
                connection.destroy();
            };

            async.mapSeries(dummy, iteratorAsync, resultAsync);
        }
    });
}
github soomtong / blititor / module / controller_hub / lib / database.js View on Github external
callback(null, result);
                });
            };

            var resultAsync = function (err, result) {
                console.log(' = Inserted controller records...');

                // for async
                done && done(err, result);

                // close connection
                connection.destroy();
            };

            async.mapSeries(dummy, iteratorAsync, resultAsync);
        }
    });
github soomtong / blititor / module / account / lib / database.js View on Github external
console.log('   inserted records...');

                    callback(err, result);
                });
            };
            const resultAsync = function (err, result) {
                console.log(' = Inserted default records...');

                // for async
                done && done(err, result);

                // close connection
                connection.destroy();
            };

            async.mapSeries(dummy, iteratorAsync, resultAsync);
        }
    });
}
github soomtong / blititor / module / teamblog / lib / database.js View on Github external
tag_related_post_id: insertPostResult['insertId'],
                        created_at: new Date()
                    };

                    insertTagRelatedPost(connection, tagRelatedPostData, function (err, result) {
                        done(err, result);
                    });

                    winston.info('Processed tag records...', affectedId);
                });
            };

            // going sync
            var tagList = teamblogData.tags.split(',');

            async.mapSeries(tagList, iteratorAsync, resultAsync);
        } else {
            callback(err, insertPostResult);
        }
    });
}