UNPKG

json-schema-to-yup

Version:

Build a Yup schema from a JSON Schema. Also supports custom/alternative schema models such as GraphQL type defs

26 lines (21 loc) 495 B
import { NumericConstraint } from '../constraints/numeric'; function createRangeConstraint(typer) { return new RangeConstraint(typer); } class RangeConstraint extends NumericConstraint { constructor(typer) { super(typer); } get $map() { return { moreThan: ["exclusiveMinimum", "moreThan"], lessThan: ["exclusiveMaximum", "lessThan"], max: ["maximum", "max"], min: ["minimum", "min"] }; } } export { createRangeConstraint, RangeConstraint };