(self, fn)
| 1067 | */ |
| 1068 | /* jshint +W101 */ |
| 1069 | function bind(self, fn) { |
| 1070 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1071 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1072 | return curryArgs.length |
| 1073 | ? function() { |
| 1074 | return arguments.length |
| 1075 | ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0))) |
| 1076 | : fn.apply(self, curryArgs); |
| 1077 | } |
| 1078 | : function() { |
| 1079 | return arguments.length |
| 1080 | ? fn.apply(self, arguments) |
| 1081 | : fn.call(self); |
| 1082 | }; |
| 1083 | } else { |
| 1084 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1085 | return fn; |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | |
| 1090 | function toJsonReplacer(key, value) { |
no test coverage detected