Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x | import { ConstantCase } from '../types' import { snakeCase } from 'lodash-uni' /** * 转换文本为大写字符串,单词之间带有下划线。 * * @param text 要转换的文本 * @returns 返回结果 * @example * ```typescript * constantCase('test string') * // => TEST_STRING * ``` */ export function constantCase<T extends string>(text: T): ConstantCase<T> { return snakeCase(text).toUpperCase() as any } |