How to use the async-es.filterLimit function in async-es

To help you get started, we’ve selected a few async-es 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 ironscript / ironscript / iron / evalAsync.js View on Github external
evalAsync( _func, env, (err, _env, _, func) => {
						if (func instanceof Function) {
							let cbfn = (arg, _cb) => {
								nextTick (func, null, env, (err, _env, _, val) => {_cb(err, val);}, arg.val, arg.index);
							}
							if (_map.equal(xarray[0]))
								mapLimit (arr, 32, cbfn, (err, newarr) => {
									if (seq.__itype__==='sequence') cb( err, env, null, new Sequence(newarr));
									else cb( err, env, null, newarr);
								});
							else 
								filterLimit (arr, 32, cbfn, (err, newarr) => {
									let retarr = [];
									for (let it of newarr) retarr.push(it.val);
									if (seq.__itype__==='sequence') cb( err, env, null, new Sequence(retarr));
									else cb( err, env, null, retarr);
								});
						}
						else cb( Cell.stringify(_func)+' is not a Function');
					});
				}

async-es

Higher-order functions and common patterns for asynchronous code

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis