(self, fn)
| 997 | */ |
| 998 | /* jshint +W101 */ |
| 999 | function bind(self, fn) { |
| 1000 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1001 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1002 | return curryArgs.length |
| 1003 | ? function() { |
| 1004 | return arguments.length |
| 1005 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 1006 | : fn.apply(self, curryArgs); |
| 1007 | } |
| 1008 | : function() { |
| 1009 | return arguments.length |
| 1010 | ? fn.apply(self, arguments) |
| 1011 | : fn.call(self); |
| 1012 | }; |
| 1013 | } else { |
| 1014 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1015 | return fn; |
| 1016 | } |
| 1017 | } |
| 1018 | |
| 1019 | |
| 1020 | function toJsonReplacer(key, value) { |
no test coverage detected