How to use the neo-async.map 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 / 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 msioda / BioLockJ / web_app / node_modules / handlebars / lib / precompiler.js View on Github external
function loadStrings(opts, callback) {
  let strings = arrayCast(opts.string),
      names = arrayCast(opts.name);

  if (names.length !== strings.length
      && strings.length > 1) {
    return callback(new Handlebars.Exception('Number of names did not match the number of string inputs'));
  }

  Async.map(strings, function(string, callback) {
      if (string !== '-') {
        callback(undefined, string);
      } else {
        // Load from stdin
        let buffer = '';
        process.stdin.setEncoding('utf8');

        process.stdin.on('data', function(chunk) {
          buffer += chunk;
        });
        process.stdin.on('end', function() {
          callback(undefined, buffer);
        });
      }
    },
    function(err, strings) {
github publiclab / Leaflet.DistortableImage / node_modules / handlebars / lib / precompiler.js View on Github external
function loadStrings(opts, callback) {
  let strings = arrayCast(opts.string),
      names = arrayCast(opts.name);

  if (names.length !== strings.length
      && strings.length > 1) {
    return callback(new Handlebars.Exception('Number of names did not match the number of string inputs'));
  }

  Async.map(strings, function(string, callback) {
      if (string !== '-') {
        callback(undefined, string);
      } else {
        // Load from stdin
        let buffer = '';
        process.stdin.setEncoding('utf8');

        process.stdin.on('data', function(chunk) {
          buffer += chunk;
        });
        process.stdin.on('end', function() {
          callback(undefined, buffer);
        });
      }
    },
    function(err, strings) {
github weixin / Miaow / node_modules / webpack / lib / NormalModuleFactory.js View on Github external
resolveRequestArray(contextInfo, context, array, resolver, callback) {
		if (array.length === 0) return callback(null, []);
		asyncLib.map(
			array,
			(item, callback) => {
				resolver.resolve(
					contextInfo,
					context,
					item.loader,
					{},
					(err, result) => {
						if (
							err &&
							/^[^/]*$/.test(item.loader) &&
							!/-loader$/.test(item.loader)
						) {
							return resolver.resolve(
								contextInfo,
								context,
github thenewvu / hot-config / src / index.js View on Github external
(files, next) => {
      log.verbose('Found files, %j', files)
      async.map(files, loadFile, next)
    },
    (configs, next) => {
github johandb / svg-drawing-tool / node_modules / webpack / lib / MultiCompiler.js View on Github external
const runCompilers = callback => {
			if (remainingCompilers.length === 0) return callback();
			asyncLib.map(
				getReadyCompilers(),
				(compiler, callback) => {
					fn(compiler, err => {
						if (err) return callback(err);
						fulfilledNames.add(compiler.name);
						runCompilers(callback);
					});
				},
				callback
			);
		};
		runCompilers(callback);
github johandb / svg-drawing-tool / node_modules / webpack / lib / ContextModuleFactory.js View on Github external
callback => {
							asyncLib.map(
								loaders,
								(loader, callback) => {
									loaderResolver.resolve(
										{},
										context,
										loader,
										{},
										(err, result) => {
											if (err) return callback(err);
											callback(null, result);
										}
									);
								},
								callback
							);
						}
github widdix / aws-cf-checker / index.js View on Github external
function runChecks(objects, checks, cb) {
  async.map(Object.keys(checks), function(check, cb) {
    var required;
    try {
      required = require("./check/" + check + ".js");
    } catch (err) {
      cb(err);
      return;
    }
    required.check(objects, checks[check], function(err, findings) {
      if (err) {
        cb(err);
      } else {
        cb(null, findings);
      }
    });
  }, function(err, nestedFindings) {
    if (err) {
github soomtong / blititor / core / lib / theme.js View on Github external
fs.readdir(themeFolder, function (error, directories) {
        async.map(directories, getThemeInfo,
            function (error, result) {
                callback(result);
            });
    });
}
github makuga01 / dnsFookup / FE / node_modules / webpack / lib / ContextModuleFactory.js View on Github external
callback => {
							asyncLib.map(
								loaders,
								(loader, callback) => {
									loaderResolver.resolve(
										{},
										context,
										loader,
										{},
										(err, result) => {
											if (err) return callback(err);
											callback(null, result);
										}
									);
								},
								callback
							);
						}