/
erioxis
/
web-nodejs
Обзор
Документация
Войти
/
erioxis
/
web-nodejs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/node_modules/avvio/lib/validate-plugin.js
26 строк
697 B
erioxis
lab11fix
15 дек 2025, 23:21
15 дек 2025, 23:21
70dc7ba
Код
Авторство
О чём код?
'use strict' const { AVV_ERR_PLUGIN_NOT_VALID } = require('./errors') /** * @param {any} maybePlugin * @throws {AVV_ERR_PLUGIN_NOT_VALID} * * @returns {asserts plugin is Function|PromiseLike} */ function validatePlugin (maybePlugin) { // validate if plugin is a function or Promise if (!(maybePlugin && (typeof maybePlugin === 'function' || typeof maybePlugin.then === 'function'))) { if (Array.isArray(maybePlugin)) { throw new AVV_ERR_PLUGIN_NOT_VALID('array') } else if (maybePlugin === null) { throw new AVV_ERR_PLUGIN_NOT_VALID('null') } else { throw new AVV_ERR_PLUGIN_NOT_VALID(typeof maybePlugin) } } } module.exports = { validatePlugin }