(self, fn)
| 980 | */ |
| 981 | /* jshint +W101 */ |
| 982 | function bind(self, fn) { |
| 983 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 984 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 985 | return curryArgs.length |
| 986 | ? function() { |
| 987 | return arguments.length |
| 988 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 989 | : fn.apply(self, curryArgs); |
| 990 | } |
| 991 | : function() { |
| 992 | return arguments.length |
| 993 | ? fn.apply(self, arguments) |
| 994 | : fn.call(self); |
| 995 | }; |
| 996 | } else { |
| 997 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 998 | return fn; |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | |
| 1003 | function toJsonReplacer(key, value) { |
no test coverage detected