On 7 January 2011 20:31, Nick Fitzgerald <[email protected]> wrote: > Hello everyone! > Noodles 277 lines long, but with over 100 lines of comments I hope I'm not > asking for too much when requesting code review :) > Its pretty well known in the JS circle that if you are iterating over a > really big list and doing a fairly expensive operation on each iteration, > you can block the browser's UI thread and make it look like it froze for a > few seconds. A common way to get around this (which is often easier than > actually making your algorithms more performant) is to use some asynchronous > version of `Array.prototype.forEach` so that the browser can have a moment > to update the UI between every few iterations. This is what I mean by > non-blocking. > I thought it would be cool to have an async version for most of the HOFs on > Array.prototype. Then I thought, well what if the operation on each > iteration is asynchronous? And so I transformed it to use continuation > passing style and callbacks. > Right now, this is what is implemented: reduce, map, filter, forEach, every, > and some. Everything is implemented in terms of reduce (other than reduce > itself of course). > I would love to get some feedback on this mini project! > Thanks in advance to everyone! > Project: https://github.com/fitzgen/noodles > > Main file: https://github.com/fitzgen/noodles/blob/master/noodles.js
There's no need to use the unary `+` operator on your Date objects. Using the subtraction operator on two Date objects will implicitly convert each to its time value and return the difference. Tim -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
