UNPKG

does-email-exist

Version:
27 lines 912 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createOutput = void 0; const OrderedLevels = ['regex', 'typo', 'disposable', 'mx', 'smtp']; exports.createOutput = (failLevel, failReason, failCode) => { const out = { valid: true, validators: {} }; if (failLevel) { out.reason = failLevel; out.valid = false; } let valid = true; for (let i = 0; i < OrderedLevels.length; i++) { const level = OrderedLevels[i]; const levelOut = { valid }; if (level === failLevel) { valid = false; levelOut.valid = false; levelOut.reason = failReason; if (failCode) { levelOut.code = typeof failCode === 'string' ? parseInt(failCode) : failCode; } } out.validators[level] = levelOut; } return out; }; //# sourceMappingURL=output.js.map