@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 • 736 B
JavaScript
/**
* @module Collection
*/
import {} from "@standard-schema/spec";
import { validate, ValidationError } from "../../../../utilities/_module.js";
/**
* @internal
*/
export class AsyncValidateIterable {
iterable;
schema;
constructor(iterable, schema) {
this.iterable = iterable;
this.schema = schema;
}
async *[Symbol.asyncIterator]() {
for await (const item of this.iterable) {
try {
yield await validate(this.schema, item);
}
catch (error) {
if (!(error instanceof ValidationError)) {
throw error;
}
}
}
}
}
//# sourceMappingURL=async-validate-iterable.js.map