UNPKG

typia

Version:

Superfast runtime validators with only one line

19 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._randomFormatEmail = void 0; const _randomString_1 = require("./_randomString"); const _randomStringLength_1 = require("./_randomStringLength"); const _randomFormatEmail = (props) => { if ((props === null || props === void 0 ? void 0 : props.minLength) === undefined && (props === null || props === void 0 ? void 0 : props.maxLength) === undefined) return `${random(10)}@${random(10)}.${random(3)}`; // `<local>@<domain>.<tld>`: the local part absorbs the requested length while // a one-character domain and tld keep the fixed overhead (`@`, `.`) minimal. return `${(0, _randomStringLength_1._randomSegmentLength)(props, 4, 10, 1)}@${random(1)}.${random(1)}`; }; exports._randomFormatEmail = _randomFormatEmail; const random = (length) => (0, _randomString_1._randomString)({ type: "string", minLength: length, maxLength: length, }); //# sourceMappingURL=_randomFormatEmail.js.map