Server IP : 127.0.0.2 / Your IP : 18.222.25.95 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/npm/node_modules/aproba/ |
Upload File : |
"use strict" var types = { "*": ["any", function () { return true }], A: ["array", function (thingy) { return thingy instanceof Array || (typeof thingy === "object" && thingy.hasOwnProperty("callee")) }], S: ["string", function (thingy) { return typeof thingy === "string" }], N: ["number", function (thingy) { return typeof thingy === "number" }], F: ["function", function (thingy) { return typeof thingy === "function" }], O: ["object", function (thingy) { return typeof thingy === "object" && !types.A[1](thingy) && !types.E[1](thingy) }], B: ["boolean", function (thingy) { return typeof thingy == "boolean" }], E: ["error", function (thingy) { return thingy instanceof Error }] } var validate = module.exports = function (schema, args) { if (!schema) throw missingRequiredArg(0, "schema") if (!args) throw missingRequiredArg(1, "args") if (!types.S[1](schema)) throw invalidType(0, "string", schema) if (!types.A[1](args)) throw invalidType(1, "array", args) for (var ii = 0; ii < schema.length; ++ii) { var type = schema[ii] if (!types[type]) throw unknownType(ii, type) var typeLabel = types[type][0] var typeCheck = types[type][1] if (type === "E" && args[ii] == null) continue if (args[ii] == null) throw missingRequiredArg(ii) if (!typeCheck(args[ii])) throw invalidType(ii, typeLabel, args[ii]) if (type === "E") return } if (schema.length < args.length) throw tooManyArgs(schema.length, args.length) } function missingRequiredArg(num) { return newException("EMISSINGARG", "Missing required argument #"+(num+1)) } function unknownType(num, type) { return newException("EUNKNOWNTYPE", "Unknown type "+type+" in argument #"+(num+1)) } function invalidType(num, type, value) { return newException("EINVALIDTYPE", "Argument #"+(num+1)+": Expected "+type+" but got "+typeof value) } function tooManyArgs(expected, got) { return newException("ETOOMANYARGS", "Too many arguments, expected "+expected+" and got "+got) } function newException(code, msg) { var e = new Error(msg) e.code = code Error.captureStackTrace(e, validate) return e }