Skip to content

Commit

Permalink
Fixes jashkenas#891 -- pull native functions off of literals instead …
Browse files Browse the repository at this point in the history
…of prototypes.
  • Loading branch information
jashkenas committed Dec 11, 2012
1 parent 78887cf commit 15425de
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions underscore.js
Expand Up @@ -17,31 +17,31 @@
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};

// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Save bytes in the minified version:
var array = [], object = {};

// Create quick reference variables for speed access to core prototypes.
var push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
var push = array.push,
slice = array.slice,
concat = array.concat,
toString = object.toString,
hasOwnProperty = object.hasOwnProperty;

// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeForEach = array.forEach,
nativeMap = array.map,
nativeReduce = array.reduce,
nativeReduceRight = array.reduceRight,
nativeFilter = array.filter,
nativeEvery = array.every,
nativeSome = array.some,
nativeIndexOf = array.indexOf,
nativeLastIndexOf = array.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
nativeBind = Function.prototype.bind;

// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
Expand Down

0 comments on commit 15425de

Please sign in to comment.