st-common-core
Version:
小尾巴前端通用核心库
43 lines (42 loc) • 1.37 kB
TypeScript
/**
* 由小写字母组成的字符串
*
* @type {string}
*/
export declare const LOWER_CASE_LETTERS = "abcdefghijklmnopqrstuvwxyz";
/**
* 由大写字母组成的字符串
*
* @type {string}
*/
export declare const UPPER_CASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/**
* 由数字组成的字符串
*
* @type {string}
*/
export declare const DIGITS = "0123456789";
/**
* 要生成的随机字符串的类型的字符串名称常量对象
*/
export declare const RandomStrTypeConst: {
readonly ALL: "ALL";
readonly LOWER_CASE_LETTERS: "LOWER_CASE_LETTERS";
readonly UPPER_CASE_LETTERS: "UPPER_CASE_LETTERS";
readonly ALL_CASE_LETTERS: "ALL_CASE_LETTERS";
readonly DIGITS: "DIGITS";
readonly LOWER_CASE_LETTERS_DIGITS: "LOWER_CASE_LETTERS_DIGITS";
readonly UPPER_CASE_LETTERS_DIGITS: "UPPER_CASE_LETTERS_DIGITS";
};
/**
* 要生成的随机字符串类型
*/
export type RandomStrType = typeof RandomStrTypeConst[keyof typeof RandomStrTypeConst];
/**
* 生成指定类型和长度的随机字符串<br/>
*
* @param {RandomStrTypeEnum} randomStrType 随机字符串类型
* @param {number} len 随机字符串长度,如果小于等于 0,则直接返回空字符串
* @returns {string} 指定类型和长度的随机字符串
*/
export declare const genRandomStr: (randomStrType: RandomStrType, len: number) => string;