UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

16 lines (15 loc) 459 B
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); } format(value) { return this.source.format(value); } }