text: /**
   * @generated-from ./$batch.js
   * This file is autogenerated from a template. Please do not edit it directly.
   * To rebuild it from its template use the command
   * > npm run generate
   * More information can be found in CONTRIBUTING.md
   */
  
  import { asyncIterableCurry } from '../../internal/async-iterable.js';
  import { __asyncSpliterate } from '../$spliterate/async-spliterate.js';
  
  async function* asyncBatchSpliterator(split, { size }, source) {
    let i = 0;
    for await (const value of source) {
      if (i === size) {
        yield split;
        i = 0;
      }
      yield value;
      i++;
    }
  }
  
  export function __asyncBatch(source, size) {
    return __asyncSpliterate(source, asyncBatchSpliterator, { size });
  }
  
  export const asyncBatch = /*#__PURE__*/ asyncIterableCurry(__asyncBatch, {
    validateArgs(args) {
      if (typeof args[1] !== 'number' || args[1] < 1) {
        throw new TypeError('batch size should be a number greater than zero');
      }
    },
  });
  