Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
array-async
Advanced tools
v3.x - Diet Cola Edition
ArrayAsync provides asynchronous counterparts for each of the Array iterate methods
forEachAsync
everyAsync
someAsync
filterAsync
mapAsync
reduceAsync
reduceRightAsync\*
(uses reversed copy of original array)Each of the other array methods is a thin (12-line long) wrapper around the
diet (27-line long) forEachAsync
,
which is the core workhorse.
Where size is a concern and you don't need all 86 lines of code, I would invite you to simply look at the source and copy/paste what you need (and attribute, of course).
<script src="https://raw.github.com/FuturesJS/forEachAsync/master/forEachAsync.js"></script>
<script src="https://raw.github.com/FuturesJS/ArrayAsync/master/array-async.js"></script>
(function () {
'use strict';
var filterAsync = window.filterAsync
;
filterAsync(['dogs', 'cats', 'octocats'], function (next, element) {
askTheUserIfTheyLikeThis(element, function (likesIt) {
next(likesIt);
});
}).then(function (newArr) {
showTheUserThingsTheyLike(newArr);
});
}());
npm install array-async
(function () {
'use strict';
var ArrayAsync = require('async-array').filterAsync
;
filterAsync(['dogs', 'cats', 'octocats'], function (next, element) {
askTheUserIfTheyLikeThis(element, function (likesIt) {
next(likesIt);
});
}).then(function (newArr) {
showTheUserThingsTheyLike(newArr);
});
}());
I'm not sure which is the clear win yet:
Call each *Async function as needed
var mapAsync = require('array-async').mapAsync
;
Use them attached to ArrayAsync object
var ArrayAsync = require('array-async').ArrayAsync
;
// Access each without the trailing 'Async'
ArrayAsync.reduce(arr, fn);
Attach the async methods to Array
require('array-async').infect(Array);
Array.filterAsync(array, fn);
I've been the prototype route before... it was a bad idea.
FAQs
FuturesJS/ArrayAsync - The diet cola of asynchronous array utilities.
We found that array-async demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.