wow
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
import { ElementType } from '../types';
|
||||
declare const OrderedLevels: readonly ["regex", "typo", "disposable", "mx", "smtp"];
|
||||
export declare type SubOutputFormat = {
|
||||
valid: boolean;
|
||||
reason?: string;
|
||||
};
|
||||
declare type Level = ElementType<typeof OrderedLevels>;
|
||||
export declare type OutputFormat = SubOutputFormat & {
|
||||
validators: {
|
||||
[K in Level]?: SubOutputFormat;
|
||||
};
|
||||
};
|
||||
export declare const createOutput: (failLevel?: "regex" | "typo" | "disposable" | "mx" | "smtp" | undefined, failReason?: string | undefined) => OutputFormat;
|
||||
export {};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createOutput = void 0;
|
||||
const OrderedLevels = ['regex', 'typo', 'disposable', 'mx', 'smtp'];
|
||||
exports.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;
|
||||
};
|
||||
//# sourceMappingURL=output.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/output/output.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,CAAU,CAAA;AAc/D,QAAA,YAAY,GAAG,CAC1B,SAAiB,EACjB,UAAmB,EACL,EAAE;IAChB,MAAM,GAAG,GAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;IACzD,IAAI,SAAS,EAAE;QACb,GAAG,CAAC,MAAM,GAAG,SAAS,CAAA;QACtB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;KAClB;IACD,IAAI,KAAK,GAAG,IAAI,CAAA;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,QAAQ,GAAoB,EAAE,KAAK,EAAE,CAAA;QAC3C,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,KAAK,GAAG,KAAK,CAAA;YACb,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAA;YACtB,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAA;SAC7B;QACD,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAA;KACjC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
||||
Reference in New Issue
Block a user