(this: Ajv, keyword: string | string[], def?: KeywordDefinition)
| 824 | const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i |
| 825 | |
| 826 | function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void { |
| 827 | const {RULES} = this |
| 828 | eachItem(keyword, (kwd) => { |
| 829 | if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`) |
| 830 | if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`) |
| 831 | }) |
| 832 | if (!def) return |
| 833 | if (def.$data && !("code" in def || "validate" in def)) { |
| 834 | throw new Error('$data keyword must have "code" or "validate" function') |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | function addRule( |
| 839 | this: Ajv, |
nothing calls this directly
no test coverage detected
searching dependent graphs…