1// bind method 2if (Function.prototype.bind == null) { 3 4 Function.prototype.bind = (function (slice) { 5 6 // (C) WebReflection - Mit Style License 7 function bind(context) { 8 9 var self = this; // "trapped" function reference 10 11 // only if there is more than an argument 12 // we are interested into more complex operations 13 // this will speed up common bind creation 14 // avoiding useless slices over arguments 15 if (1 < arguments.length) { 16 // extra arguments to send by default 17 var $arguments = slice.call(arguments, 1); 18 return function () { 19 return self.apply( 20 context, 21 // thanks @kangax for this suggestion 22 arguments.length ? 23 // concat arguments with those received 24 $arguments.concat(slice.call(arguments)) : 25 // send just arguments, no concat, no slice 26 $arguments 27 ); 28 }; 29 } 30 // optimized callback 31 return function () { 32 // speed up when function is called without arguments 33 return arguments.length ? self.apply(context, arguments) : self.call(context); 34 }; 35 } 36 37 // the named function 38 return bind; 39 40 }(Array.prototype.slice)); 41 42}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.