mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
changing order of operations to force an errror when _.bind -ing null or undefined values.
This commit is contained in:
@@ -408,8 +408,9 @@
|
|||||||
// Create a function bound to a given object (assigning `this`, and arguments,
|
// Create a function bound to a given object (assigning `this`, and arguments,
|
||||||
// optionally). Binding with arguments is also known as `curry`.
|
// optionally). Binding with arguments is also known as `curry`.
|
||||||
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
|
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
|
||||||
|
// We check for `func.bind` first, to fail fast when `func` is undefined.
|
||||||
_.bind = function(func, obj) {
|
_.bind = function(func, obj) {
|
||||||
if (nativeBind && func.bind === nativeBind) return func.bind.apply(func, slice.call(arguments, 1));
|
if (func.bind === nativeBind && nativeBind) return func.bind.apply(func, slice.call(arguments, 1));
|
||||||
var args = slice.call(arguments, 2);
|
var args = slice.call(arguments, 2);
|
||||||
return function() {
|
return function() {
|
||||||
return func.apply(obj, args.concat(slice.call(arguments)));
|
return func.apply(obj, args.concat(slice.call(arguments)));
|
||||||
|
|||||||
Reference in New Issue
Block a user