Skip to content

Commit

Permalink
ES5 spec requires calling Object() on reduce input array. Adding back…
Browse files Browse the repository at this point in the history
… shift operator to account for strings, etc. thanks @rwldrn
  • Loading branch information
briancavalier committed Nov 14, 2011
1 parent 21083d1 commit fda80dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions when.js
Expand Up @@ -57,8 +57,8 @@ define([], function() {
var arr, args, reduced, len, i;

i = 0;
arr = this;
len = arr.length;
arr = Object(this);
len = arr.length >>> 0;
args = arguments;

// If no initialValue, use first item of array (we know length !== 0 here)
Expand Down

0 comments on commit fda80dc

Please sign in to comment.