(self, fn)
| 1184 | */ |
| 1185 | /* jshint +W101 */ |
| 1186 | function bind(self, fn) { |
| 1187 | var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; |
| 1188 | if (isFunction(fn) && !(fn instanceof RegExp)) { |
| 1189 | return curryArgs.length |
| 1190 | ? function () { |
| 1191 | return arguments.length |
| 1192 | ? fn.apply(self, concat(curryArgs, arguments, 0)) |
| 1193 | : fn.apply(self, curryArgs); |
| 1194 | } |
| 1195 | : function () { |
| 1196 | return arguments.length |
| 1197 | ? fn.apply(self, arguments) |
| 1198 | : fn.call(self); |
| 1199 | }; |
| 1200 | } else { |
| 1201 | // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) |
| 1202 | return fn; |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | function toJsonReplacer(key, value) { |
| 1207 | var val = value; |
no test coverage detected