| 1279 | } |
| 1280 | |
| 1281 | function reduce(values, reducer, value) { |
| 1282 | if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); |
| 1283 | const iterator = values[Symbol.iterator](); |
| 1284 | let done, next, index = -1; |
| 1285 | if (arguments.length < 3) { |
| 1286 | ({done, value} = iterator.next()); |
| 1287 | if (done) return; |
| 1288 | ++index; |
| 1289 | } |
| 1290 | while (({done, value: next} = iterator.next()), !done) { |
| 1291 | value = reducer(value, next, ++index, values); |
| 1292 | } |
| 1293 | return value; |
| 1294 | } |
| 1295 | |
| 1296 | function reverse$1(values) { |
| 1297 | if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); |