shelving
Version:
Toolkit for using data in JavaScript.
13 lines (12 loc) • 391 B
JavaScript
import { Schema } from "./Schema.js";
/** Schema that passes through to a source schema. */
export class ThroughSchema extends Schema {
source;
constructor({ source, ...options }) {
super(source instanceof Schema ? { ...source, ...options } : options);
this.source = source;
}
validate(unsafeValue) {
return this.source.validate(unsafeValue);
}
}