UNPKG

typia

Version:

Superfast runtime validators with only one line

20 lines (19 loc) 690 B
import { _randomString } from "./_randomString.mjs"; import { _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs"; //#region src/internal/_randomFormatRegex.ts const _randomFormatRegex = (props) => { if (props?.minLength === void 0 && props?.maxLength === void 0) return FIXED; const length = _randomLengthPick(_randomLengthWindow(props, { minimum: 0, spread: 16 })); return _randomString({ type: "string", minLength: length, maxLength: length }); }; const FIXED = "/^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/"; //#endregion export { _randomFormatRegex }; //# sourceMappingURL=_randomFormatRegex.mjs.map