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 /
yargs /
build /
lib /
Delete
Unzip
Name
Size
Permission
Date
Action
platform-shims
[ DIR ]
drwxr-xr-x
2023-12-23 20:12
typings
[ DIR ]
drwxr-xr-x
2023-12-23 20:12
utils
[ DIR ]
drwxr-xr-x
2023-12-23 20:12
argsert.d.ts
180
B
-rw-r--r--
2022-12-01 14:49
argsert.js
2.42
KB
-rw-r--r--
2022-12-01 14:49
cjs.d.ts
1.92
KB
-rw-r--r--
2022-12-01 14:49
command.d.ts
3.18
KB
-rw-r--r--
2022-12-01 14:49
command.js
15.07
KB
-rw-r--r--
2022-12-01 14:49
completion-templates.d.ts
1.43
KB
-rw-r--r--
2022-12-01 14:49
completion-templates.js
1.36
KB
-rw-r--r--
2022-12-01 14:49
completion.d.ts
1.06
KB
-rw-r--r--
2022-12-01 14:49
completion.js
5.4
KB
-rw-r--r--
2022-12-01 14:49
middleware.d.ts
785
B
-rw-r--r--
2022-12-01 14:49
middleware.js
2.14
KB
-rw-r--r--
2022-12-01 14:49
parse-command.d.ts
331
B
-rw-r--r--
2022-12-01 14:49
parse-command.js
1.04
KB
-rw-r--r--
2022-12-01 14:49
usage.d.ts
2.1
KB
-rw-r--r--
2022-12-01 14:49
usage.js
19.36
KB
-rw-r--r--
2022-12-01 14:49
validation.d.ts
1.78
KB
-rw-r--r--
2022-12-01 14:49
validation.js
11.92
KB
-rw-r--r--
2022-12-01 14:49
yargs-factory.d.ts
12.76
KB
-rw-r--r--
2022-12-01 14:49
yargs-factory.js
41.24
KB
-rw-r--r--
2022-12-01 14:49
yerror.d.ts
106
B
-rw-r--r--
2022-12-01 14:49
yerror.js
181
B
-rw-r--r--
2022-12-01 14:49
Save
Rename
import { argsert } from './argsert.js'; import { isPromise } from './utils/is-promise.js'; export function globalMiddlewareFactory(globalMiddleware, context) { return function (callback, applyBeforeValidation = false) { argsert('<array|function> [boolean]', [callback, applyBeforeValidation], arguments.length); if (Array.isArray(callback)) { for (let i = 0; i < callback.length; i++) { if (typeof callback[i] !== 'function') { throw Error('middleware must be a function'); } callback[i].applyBeforeValidation = applyBeforeValidation; } Array.prototype.push.apply(globalMiddleware, callback); } else if (typeof callback === 'function') { callback.applyBeforeValidation = applyBeforeValidation; globalMiddleware.push(callback); } return context; }; } export function commandMiddlewareFactory(commandMiddleware) { if (!commandMiddleware) return []; return commandMiddleware.map(middleware => { middleware.applyBeforeValidation = false; return middleware; }); } export function applyMiddleware(argv, yargs, middlewares, beforeValidation) { const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true'); return middlewares.reduce((acc, middleware) => { if (middleware.applyBeforeValidation !== beforeValidation) { return acc; } if (isPromise(acc)) { return acc .then(initialObj => Promise.all([ initialObj, middleware(initialObj, yargs), ])) .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj)); } else { const result = middleware(acc, yargs); if (beforeValidation && isPromise(result)) throw beforeValidationError; return isPromise(result) ? result.then(middlewareObj => Object.assign(acc, middlewareObj)) : Object.assign(acc, result); } }, argv); }