toArray.js 273 B

123456789101112
  1. import { reduce } from './reduce';
  2. function toArrayReducer(arr, item, index) {
  3. if (index === 0) {
  4. return [item];
  5. }
  6. arr.push(item);
  7. return arr;
  8. }
  9. export function toArray() {
  10. return reduce(toArrayReducer, []);
  11. }
  12. //# sourceMappingURL=toArray.js.map