@lancercomet/utils
Version:
My personal utils lib.
48 lines (47 loc) • 1.19 kB
TypeScript
/**
* 将字符串转化为驼峰.
*
* @example
* toCamelCase('lancer-comet') // lancerComet
*
* @param {string} text
* @returns {string}
*/
declare function toCamelCase(text: string): string;
/**
* 将字符串转换为帕斯卡.
*
* @example
* toPascalCase('lancerc-comet') // LancerComet
*
* @param {string} text
* @returns {string}
*/
declare function toPascalCase(text: string): string;
/**
* 将字符串转化为 KebabCase.
*
* @example
* toKebabCase('lancerComet') // lancer-comet
*
* @param {string} text
* @returns {string}
*/
declare function toKebabCase(text: string): string;
/**
* 获取字符串字节长度.
* 一个汉字(双字节字符)将被当作两个字节统计.
*
* @param {string} str
* @returns {number}
*/
declare function getStringByteLength(str: string): number;
/**
* 获取字符串字符长度.
* 此方法将把任意一个字符统计为 1, 包括 Unicode 的颜文字.
*
* @param {string} str
* @returns {number}
*/
declare function getStringCharCount(str: string): number;
export { getStringByteLength, toCamelCase, toPascalCase, toKebabCase, getStringCharCount };