parseBulk()
parseBulk<
T>(schema,values,options?): {success:true;data:T[]; } | {success:false;errors:string[]; }
parseBulk<
S>(schema,values,options?): {success:true;data:Infer<S>[]; } | {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.
S: S extends GenericSchemaβ
Parametersβ
Overload 1:
schema: Schema<T>β
Schema to validate against.
values: unknown[]β
Array of values to validate.
options?: ParseBulkOptionsβ
Bulk validation options.
Overload 2:
schema: Sβ
values: unknown[]β
options?: ParseBulkOptionsβ
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β
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