deep-email-validator-extended
Version:
Validates emails based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.
25 lines • 801 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.createOutput = void 0;
const OrderedLevels = ['regex', 'typo', 'disposable', 'mx', 'smtp'];
const createOutput = (failLevel, failReason) => {
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;
}
out.validators[level] = levelOut;
}
return out;
};
exports.createOutput = createOutput;
//# sourceMappingURL=output.js.map
;