UNPKG

shuffrand

Version:

Cryptographically secure randomness and shuffling — with soul.

58 lines (57 loc) 1.82 kB
/** * shuffrand Constants * * This file defines various constants used throughout the shuffrand module, * adhering to a flat, dot-categorized structure for clarity. * * @author Doron Brayer <doronbrayer@outlook.com> * @license MIT */ const E = "0123456789", _ = "abcdefghijklmnopqrstuvwxyz", A = _.toUpperCase(), T = _ + A, t = _ + A + E, I = E + _.slice(0, 6), e = { MAX_SAFE_INT: Number.MAX_SAFE_INTEGER, MIN_SAFE_INT: Number.MIN_SAFE_INTEGER, MAX_SAFE_DOUBLE: 1e15, // 10¹⁵ MIN_SAFE_DOUBLE: -1e15, // Minus 10¹⁵ UINT32_MAX_VALUE: 4294967295, // Maximum value for a 32-bit unsigned integer (2^32 - 1) UINT32_RANGE: 4294967296, // Range of a 32-bit unsigned integer (2^32) MAX_FRACTIONAL_DIGITS: 15, // Max precision for doubles (standard JS float precision) MIN_FRACTIONAL_DIGITS: 1, // Allow 0 fractional digits for doubles (i.e., integer-like doubles) MAX_ATTEMPTS_TO_GENERATE_NUM: 30, // Max retries for exclusion constraints // --- Character Set Constants (for cryptoString) --- // Now, define the properties using the base constants for "var + var" assembly. // These properties will correctly infer literal types due to 'as const'. /** * String containing all digit characters (0-9). */ DIGITS: E, /** * String containing all lowercase English alphabet characters (a-z). */ LATIN_LOWERCASE_LETTERS: _, /** * String containing all uppercase English alphabet characters (A-Z). */ LATIN_UPPERCASE_LETTERS: A, /** * String containing all English alphabet characters (a-z, A-Z). */ LATIN_LETTERS: T, /** * String containing all alphanumeric characters (a-z, A-Z, 0-9). */ ALPHANUMERIC_CHARS: t, /** * String containing all hexadecimal characters (0-9, a-f). */ HEX_CHARS: I }; export { e as Constants };