UNPKG

441 BPlain TextView Raw
1import type {CodeKeywordDefinition} from "../../types"
2import type {KeywordCxt} from "../../compile/validate"
3import {checkStrictMode} from "../../compile/util"
4
5const def: CodeKeywordDefinition = {
6 keyword: ["then", "else"],
7 schemaType: ["object", "boolean"],
8 code({keyword, parentSchema, it}: KeywordCxt) {
9 if (parentSchema.if === undefined) checkStrictMode(it, `"${keyword}" without "if" is ignored`)
10 },
11}
12
13export default def