paulmillr / async-each Goto Github PK
View Code? Open in Web Editor NEWNo-bullshit, ultra-simple, 40-lines-of-code async parallel forEach / map function for JavaScript.
License: MIT License
No-bullshit, ultra-simple, 40-lines-of-code async parallel forEach / map function for JavaScript.
License: MIT License
You already have index
in scope, it seems like count
is redundant and can be removed. Instead I believe you can check index === items.length - 1
?
@paulmillr The recent 1.0.4 release introduced a bug (also present in 1.0.5).
Since the count of items processed is no longer counted and the callback is executed when the last item is processed, we can have, and will likely have, a case where the last item finishes being processed before other items, causing the callback to be executed before the other items are finished.
The processed items must be counted in some fashion for this to work correctly.
Hi, could you please release a new patch version of async-each
which contains the license file you added?
Thanks :)
http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony
console.log('should be 1')
function sync(a, next) {
next(null, a)
}
each([ 'alpha', 'bravo', 'charlie' ], sync, function (err, result) {
console.log('should be 3')
})
console.log('should be 2')
should be 1
should be 3
should be 2
The callback should always be called asynchronously.
The MIT license explicitly requires to attach the full license text to the code or any distribution. Without this the license isn't fulfilled by the project itself and thus invalid.
Can this be remedied pls ?
https://github.com/caolan/async/blob/master/lib/async.js#L940-L945
I'm not sure if there's a good reason for the differences in how it's done here, but considering async's visibility, I assume their method is sound.
The reason:
typeof module === 'object'
in component env, module is a function. As a fix I suggest to use:
typeof module !== undefined
Any reason not to be 1.0.0
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.