import { ChacaUtils } from "../../core/utils"; export declare type Case = "lower" | "upper" | "mixed"; export declare type BigIntProps = { min?: bigint; max?: bigint; }; export declare type NumericProps = { allowLeadingZeros?: boolean; length?: number; prefix?: string; banned?: string[]; }; export declare type AlphaNumericProps = { length?: number; case?: Case; banned?: string[] | string; prefix?: string; }; export declare type BinaryCodeProps = { length?: number; prefix?: string; }; export declare type OctalProps = { length?: number; prefix?: string; }; export declare type FloatProps = { min?: number; max?: number; precision?: number; }; export declare type NumberProps = { min?: number; max?: number; precision?: number; }; export declare type IntProps = { min?: number; max?: number; }; export declare type HexadecimalProps = { length?: number; case?: Case; }; export declare type MatrixProps = { x_size?: number; y_size?: number; min?: number; max?: number; precision?: number; }; export declare type CharacterProps = { case?: Case; }; export declare type CharactersProps = { length?: number; case?: Case; }; export declare class DatatypeModule { private readonly utils; private readonly MIN_RANDOM_VALUE; private readonly MAX_RANDOM_VALUE; private readonly MAX_PRECISION; constructor(utils: ChacaUtils); readonly constants: { upperCharacters: string[]; lowerCharacters: string[]; mixedCharacters: string[]; specialCharacters: string[]; numbers: string[]; }; /** * Returns a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type) number. * The bounds are inclusive. * * @param args.min Lower bound for generated bigint. Defaults to `0n`. * @param args.max Upper bound for generated bigint. Defaults to `min + 999999999999999n`. * * @throws When `min` is greater than `max`. * * @example * modules.datatype.bigInt() // 55422n * modules.datatype.bigInt({ min: 1000000n }) // 431433n * modules.datatype.bigInt({ max: 100n }) // 42n * modules.datatype.bigInt({ min: 10n, max: 100n }) // 36n */ bigint({ max: imax, min: imin }?: BigIntProps): bigint; /** * Returns a keyboard special character * * @example modules.datatype.specialCharacter() // '_' * * @returns string */ specialCharacter(): string; /** * Returns a boolean * * @example modules.datatype.boolean() // true * * @returns boolean */ boolean(): boolean; /** * Returns a integer number * * @param args.min Minimun posible value * @param args.max Maximun posible value * * @example * modules.datatype.int() // 462 * modules.datatype.int({ min: 10, max: 30 }) // 28 * * @returns number */ int({ max, min }?: IntProps): number; /** * Returns a float number * * @param args.min Minimun posible value * @param args.max Maximun posible value * @param args.precision Precision of the float. Must be a value between `1` and `20` * * @example * modules.datatype.float() // 462.12 * modules.datatype.float({ min: 10, max: 30 }) // 10.23 * modules.datatype.float({ precision: 4 }) // 90.5362 * * @returns number */ float({ max, min, precision }?: FloatProps): number; /** * Returns a number * @param args.min Minimun posible value * @param args.max Maximun posible value * @param args.precision Precision of the number. Must be a value between `0` and `20`. * @example * modules.datatype.number() // 301 * modules.datatype.number({ min: 10, max: 30 }) // 10.2327 * @returns number */ number({ max, min, precision }?: NumberProps): number; /** * Returns a string with a hexadecimal code * * @param args.case Case of the values inside de hexadecimal code (`mixed` | `lower` | `upper`) * @param args.length Lenght of the hexadecimal code * * @example * modules.datatype.hexadecimal() // '009df' * modules.datatype.hexadecimal({ length: 3 }) // '01D' * modules.datatype.hexadecimal({ lenght: 3, case: 'upper' }) // 'DE20' * @returns string */ hexadecimal({ length: ilength, case: icase, }?: HexadecimalProps): string; /** * Return a two dimension matriz of numbers * * @param args.x_size Columns size * @param args.y_size Row size * @param args.min Min value for the numbers of the matrix * @param args.max Max value for the numbers of the matrix * @param args.precision Number precision of the matrix * * @example * modules.datatype.matrix() // [[1, 0, 5], [5, 10, 9]] * modules.datatype.matrix({ x_size: 4, y_size: 2 }) // [[1, 2], [0, 0], [1, 1], [4, 5]] */ matrix({ x_size: ix_size, max, min, precision, y_size: iy_size, }?: MatrixProps): number[][]; /** * Returns a character * * @param args.case Case of the characters (`lower`, `upper` or `mixed`) * * @example * modules.datatype.character() // 'c' * modules.datatype.character({ case: 'upper' }) // "H" * * @returns string */ character({ case: icase }?: CharacterProps): string; /** * Returns a series of characters * * @param args.length Length of characters. * @param args.case Case of the characters (`lower`, `upper` or `mixed`) * * @example * modules.datatype.characters() // 'v' * modules.datatype.characters({ length: 5 }) // 'bhtlw' * modules.datatype.characters({ length: 5, case: 'upper' }) // 'HQRSD' * * @returns string */ characters({ case: icase, length }?: CharactersProps): string; /** * Returns a string with a binary code * @param args.length Length of the binary code * @example * modules.datatype.binaryCode() // '00101' * modules.datatype.binaryCode({ length: 6 }) // '010100' * @returns string */ binaryCode({ length: ilength, prefix }?: BinaryCodeProps): string; /** * @param args.length Length of the string * @param args.case Case of the string. (`lower`, `upper`, `mixed`) * @param args.banned Characters that cannot appear in the string. It can be an array of characters or a string with all the characters * @param args.prefix Prefix for the generated string * * @example * modules.datatype.alphaNumeric() // "F43jUs" * modules.datatype.alphaNumeric({ length: 5 }) // "n3jO4" * modules.datatype.alphaNumeric({ length: 7, case = "lower" }) // "ow3kn42" * @returns string */ alphaNumeric({ length: ilength, case: icase, banned: ibanned, prefix, }?: AlphaNumericProps): string; /** * Returns an [octal](https://en.wikipedia.org/wiki/Octal) string. * * @param args.length The number or range of characters to generate after the prefix. * @param args.prefix Prefix for the generated number. Defaults to `'0o'`. * * @example * modules.datatype.octal() // '0o3' * modules.datatype.octal({ length: 10 }) // '0o1526216210' * modules.datatype.octal({ prefix: '0o' }) // '0o7' * modules.datatype.octal({ length: 10, prefix: 'oct_' }) // 'oct_1542153414' */ octal({ length: ilength, prefix }?: OctalProps): string; /** * Generates a given length string of digits. * * @param args.length The number or range of digits to generate. * @param args.allowLeadingZeros Whether leading zeros are allowed or not. Defaults to `true`. * @param args.banned An array of digits which should be excluded in the generated string. Defaults to `[]`. * @param args.prefix Prefix for the generated string * * @example * modules.datatype.numeric() // '2' * modules.datatype.numeric({ length: 42, allowLeadingZeros: false }) // '72564846278453876543517840713421451546115' * modules.datatype.numeric({ length: 6, exclude: ['0'] }) // '943228' * */ numeric({ length: ilength, allowLeadingZeros, prefix, banned, }?: NumericProps): string; private filterCharacters; private generateByLength; }