Skip to content

Commit

Permalink
Merge branch 'master' of github.com:documentcloud/underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Apr 15, 2011
2 parents 5e051fb + 1fc7d4b commit b6c39fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
iterator = iterator || _.identity;
iterator || (iterator = _.identity);
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
Expand All @@ -182,7 +182,7 @@
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator = iterator || _.identity;
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
Expand Down Expand Up @@ -255,7 +255,7 @@
// Use a comparator function to figure out at what index an object should
// be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator) {
iterator = iterator || _.identity;
iterator || (iterator = _.identity);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >> 1;
Expand Down Expand Up @@ -429,7 +429,7 @@
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher = hasher || _.identity;
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return hasOwnProperty.call(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
Expand Down

0 comments on commit b6c39fe

Please sign in to comment.