Hiya,

Instead of having `noodles` return a new manually augmented object you
can have it utilize noodles.prototype
https://github.com/fitzgen/noodles/blob/master/noodles.js#L47-56

// private
function Klass() { }

noodles = exports.noodles = function (items) {
  var instance = new Klass;
  instance.raw = items;
  return instance;
};

Klass.prototype = noodles.prototype;

This way you and others can add functions as needed to
noodles.prototype and
uses can still call noodes(items) or new noodles(items) and it would
work.

You could then pass `this.raw || this` to the noodle generic methods
when you wrap them for the initial set of prototype methods.

----------

Instead of `[].concat` you can use your `slice.call(args)`
https://github.com/fitzgen/noodles/blob/master/noodles.js#L102

And you can make `slice = Array.prototype.slice` -> `slice =
[].slice;`
https://github.com/fitzgen/noodles/blob/master/noodles.js#L36

--------

Be careful with recursive calls, especially when your array can be any
length.
You could hit a call stack limit if u get into an array with a length
of 100 or higher (varies by enviro).
https://github.com/fitzgen/noodles/blob/master/noodles.js#L115

If you are starting out async, why not just have each iteration as one
async call instead of combining async with sync bursts?

-------

It would be nice if you would allow the timeout delay to be
configurable.

I think you should hide the guts of reduce in a private method and
avoid exposing it and the extra arguments to the external API.

I don't know if you are aware, but because you make a shallow copy of
the `items` in `reduce` you support array-like objects as `items` too.
Bonus!!

-------

You might check out how I expose benchmark.js for various enviros
(Browsers, Node, Narwhal, Ringo, Rhino)
https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1934-1950
https://github.com/fitzgen/noodles/blob/master/noodles.js#L276-278

It will use Node sugar, if available, so you can use
var noodles = require('noodles');
instead of
var noodles = require('noodles').noodles;

I also avoid using the  `window` object directly and instead pass the
`this` of the global context to the closure.
https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L1950
https://github.com/mathiasbynens/benchmark.js/blob/master/benchmark.js#L9

- JDD

-- 
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]

Reply via email to