@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.
21 lines • 657 B
JavaScript
import { isPromiseLike } from "../../../../utilities/_module-exports.js";
export class ValidateIterable {
iterable;
schema;
constructor(iterable, schema) {
this.iterable = iterable;
this.schema = schema;
}
*[Symbol.iterator]() {
for (const item of this.iterable) {
const result = this.schema["~standard"].validate(item);
if (isPromiseLike(result)) {
throw new TypeError("Schema validation must be synchronous");
}
if (!result.issues) {
yield result.value;
}
}
}
}
//# sourceMappingURL=validate-iterable.js.map