Linux v69820.1blu.de 4.15.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
Apache/2.4.58
Server IP : 195.90.215.149 & Your IP : 216.73.217.80
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
share /
nodejs /
ajv /
lib /
vocabularies /
jtd /
Delete
Unzip
Name
Size
Permission
Date
Action
discriminator.ts
2.59
KB
-rw-r--r--
2023-12-16 08:36
elements.ts
976
B
-rw-r--r--
2023-12-16 08:36
enum.ts
1.59
KB
-rw-r--r--
2023-12-16 08:36
error.ts
746
B
-rw-r--r--
2023-12-16 08:36
index.ts
1007
B
-rw-r--r--
2023-12-16 08:36
metadata.ts
716
B
-rw-r--r--
2023-12-16 08:36
nullable.ts
649
B
-rw-r--r--
2023-12-16 08:36
optionalProperties.ts
394
B
-rw-r--r--
2023-12-16 08:36
properties.ts
6.1
KB
-rw-r--r--
2023-12-16 08:36
ref.ts
2.29
KB
-rw-r--r--
2023-12-16 08:36
type.ts
2.49
KB
-rw-r--r--
2023-12-16 08:36
union.ts
292
B
-rw-r--r--
2023-12-16 08:36
values.ts
1.64
KB
-rw-r--r--
2023-12-16 08:36
Save
Rename
import type {CodeKeywordDefinition, KeywordErrorDefinition, ErrorObject} from "../../types" import type {KeywordCxt} from "../../compile/validate" import {_, or, and, Code} from "../../compile/codegen" import {checkMetadata} from "./metadata" import {checkNullable} from "./nullable" export type JTDEnumError = ErrorObject<"enum", {allowedValues: string[]}, string[]> const error: KeywordErrorDefinition = { message: "must be equal to one of the allowed values", params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, } const def: CodeKeywordDefinition = { keyword: "enum", schemaType: "array", error, code(cxt: KeywordCxt) { checkMetadata(cxt) const {gen, data, schema, schemaValue, parentSchema, it} = cxt if (schema.length === 0) throw new Error("enum must have non-empty array") if (schema.length !== new Set(schema).size) throw new Error("enum items must be unique") let valid: Code const isString = _`typeof ${data} == "string"` if (schema.length >= it.opts.loopEnum) { let cond: Code ;[valid, cond] = checkNullable(cxt, isString) gen.if(cond, loopEnum) } else { /* istanbul ignore if */ if (!Array.isArray(schema)) throw new Error("ajv implementation error") valid = and(isString, or(...schema.map((value: string) => _`${data} === ${value}`))) if (parentSchema.nullable) valid = or(_`${data} === null`, valid) } cxt.pass(valid) function loopEnum(): void { gen.forOf("v", schemaValue as Code, (v) => gen.if(_`${valid} = ${data} === ${v}`, () => gen.break()) ) } }, } export default def