UNPKG

typia

Version:

Superfast runtime validators with only one line

26 lines (25 loc) 945 B
import { _randomString } from "./_randomString.mjs"; import { _randomLengthPick, _randomLengthWindow, _randomSegmentLength } from "./_randomStringLength.mjs"; //#region src/internal/_randomFormatJsonPointer.ts const _randomFormatJsonPointer = (props) => { if (props?.minLength === void 0 && props?.maxLength === void 0) return `${PREFIX}${random()}`; if (props.maxLength === void 0 || props.maxLength >= PREFIX.length) return `${PREFIX}${_randomSegmentLength(props, PREFIX.length, 10, 0)}`; const length = _randomLengthPick(_randomLengthWindow(props, { minimum: 0, spread: 6 })); return length === 0 ? "" : `/${_randomString({ type: "string", minLength: length - 1, maxLength: length - 1 })}`; }; const PREFIX = "/components/schemas/"; const random = () => _randomString({ type: "string", minLength: 10, maxLength: 10 }); //#endregion export { _randomFormatJsonPointer }; //# sourceMappingURL=_randomFormatJsonPointer.mjs.map