@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
29 lines • 710 B
JavaScript
/**
* @module Collection
*/
import {} from "@standard-schema/spec";
import { validateSync, ValidationError } from "../../../../utilities/_module.js";
/**
* @internal
*/
export class ValidateIterable {
iterable;
schema;
constructor(iterable, schema) {
this.iterable = iterable;
this.schema = schema;
}
*[Symbol.iterator]() {
for (const item of this.iterable) {
try {
yield validateSync(this.schema, item);
}
catch (error) {
if (!(error instanceof ValidationError)) {
throw error;
}
}
}
}
}
//# sourceMappingURL=validate-iterable.js.map