Skip to main content

parseBulk()

parseBulk<T>(schema, values, options?): { success: true; data: T[]; } | { success: false; errors: string[]; }

Bulk validation with two modes:

  • Early abort: stops at first validation failure (fastest).
  • Complete: collects all errors (comprehensive).

Type Parametersโ€‹

T: Tโ€‹

The expected output type of the schema.


Parametersโ€‹

schema: Schema<T>โ€‹

Schema to validate against.

values: unknown[]โ€‹

Array of values to validate.

options?: ParseBulkOptionsโ€‹

Bulk validation options.


Returns: { success: true; data: T[]; } | { success: false; errors: string[]; }โ€‹

Result object with success flag and data array or errors array.


Sinceโ€‹

2.0.0


Performanceโ€‹

Optimization: Pre-allocation and early abort mode.

ParseBulkOptionsโ€‹

Interface

Options for parseBulk function.


Sinceโ€‹

2.0.0


Propertiesโ€‹

earlyAbort?: booleanโ€‹

If true, stops at first validation failure (fastest mode). If false, collects all errors (comprehensive mode).

Default Valueโ€‹

false