Aller au contenu principal

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