UNPKG

shuffrand

Version:

Cryptographically secure randomness and shuffling — with soul.

26 lines (25 loc) 874 B
import { type as e } from "arktype"; import { Constants as n } from "./constants.es.js"; const o = e("number").atLeast(n.MIN_SAFE_INT).atMost(n.MAX_SAFE_INT), t = e({ lowerBound: o.optional(), upperBound: o.optional(), typeOfNum: "'integer'|'double'?", exclusion: "'none'|'lower bound'|'upper bound'|'both'?", maxFracDigits: "0 <= number.integer <= 15?" }), s = e({ arr: "unknown[]?", isDestructive: "boolean?", preventIdentical: "boolean?", // Temporarily skip ArkType validation for these fields - let custom validation handle them startIndex: "unknown?", endIndex: "unknown?" }), u = e({ length: "number.integer>=0?", characterSet: "string | 'alphanumeric' | 'numeric' | 'alpha' | 'hex' | 'uppercase' | 'lowercase' ?", noRepeat: "boolean?" }); export { u as cryptoStringParamsSchema, t as randomParamsSchema, s as shuffleParamsSchema };