(self, fn)
| 1174 | */ |
| 1175 | /* jshint +W101 */ |
| 1176 | function bind(self, fn) { |
| 1177 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1178 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1179 | return curryArgs.length |
| 1180 | ? function() { |
| 1181 | return arguments.length |
| 1182 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 1183 | : fn.apply(self, curryArgs); |
| 1184 | } |
| 1185 | : function() { |
| 1186 | return arguments.length |
| 1187 | ? fn.apply(self, arguments) |
| 1188 | : fn.call(self); |
| 1189 | }; |
| 1190 | } else { |
| 1191 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1192 | return fn; |
| 1193 | } |
| 1194 | } |
| 1195 | |
| 1196 | |
| 1197 | function toJsonReplacer(key, value) { |
no test coverage detected