(self, fn)
| 1206 | */ |
| 1207 | /* jshint +W101 */ |
| 1208 | function bind(self, fn) { |
| 1209 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1210 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1211 | return curryArgs.length |
| 1212 | ? function() { |
| 1213 | return arguments.length |
| 1214 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 1215 | : fn.apply(self, curryArgs); |
| 1216 | } |
| 1217 | : function() { |
| 1218 | return arguments.length |
| 1219 | ? fn.apply(self, arguments) |
| 1220 | : fn.call(self); |
| 1221 | }; |
| 1222 | } else { |
| 1223 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1224 | return fn; |
| 1225 | } |
| 1226 | } |
| 1227 | |
| 1228 | |
| 1229 | function toJsonReplacer(key, value) { |
no test coverage detected