- yf.each(function (hook) {
- promises.push(hook.call(yuu, initOptions));
- }, initHooks);
+ // initHooks can be pushed to while iterating, so iterate
+ // by index, not a foreach loop.
+ for (var i = 0; i < initHooks.length; ++i)
+ promises.push(initHooks[i].call(yuu, initOptions));