(self, fn)
| 1153 | */ |
| 1154 | /* jshint +W101 */ |
| 1155 | function bind(self, fn) { |
| 1156 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1157 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1158 | return curryArgs.length |
| 1159 | ? function() { |
| 1160 | return arguments.length |
| 1161 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 1162 | : fn.apply(self, curryArgs); |
| 1163 | } |
| 1164 | : function() { |
| 1165 | return arguments.length |
| 1166 | ? fn.apply(self, arguments) |
| 1167 | : fn.call(self); |
| 1168 | }; |
| 1169 | } else { |
| 1170 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1171 | return fn; |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | |
| 1176 | function toJsonReplacer(key, value) { |
no test coverage detected