typia
Version:
Superfast runtime validators with only one line
1 lines • 1.31 kB
Source Map (JSON)
{"version":3,"file":"_randomFormatIdnEmail.mjs","names":[],"sources":["../../src/internal/_randomFormatIdnEmail.ts"],"sourcesContent":["import { _randomString } from \"./_randomString\";\nimport { _ILengthProps, _randomSegmentLength } from \"./_randomStringLength\";\n\nexport const _randomFormatIdnEmail = (props?: _ILengthProps): string => {\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return `${random(10)}@${random(10)}.${random(3)}`;\n // `_isFormatIdnEmail` requires a >=2-char TLD (`(…\\.)+[^…]{2,}`), so the fixed\n // overhead is `@` + domain(1) + `.` + tld(2) = 5 and the local part absorbs the\n // requested length; a one-character TLD (the non-idn generator's length path)\n // would be rejected by the idn checker on every draw.\n return `${_randomSegmentLength(props, 5, 10, 1)}@${random(1)}.${random(2)}`;\n};\n\nconst random = (length: number) =>\n _randomString({\n type: \"string\",\n minLength: length,\n maxLength: length,\n });\n"],"mappings":";;;AAGA,MAAa,yBAAyB,UAAkC;CACtE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,GAAG,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC;CAKhD,OAAO,GAAG,qBAAqB,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC;AAC1E;AAEA,MAAM,UAAU,WACd,cAAc;CACZ,MAAM;CACN,WAAW;CACX,WAAW;AACb,CAAC"}