mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
16 lines
319 B
TypeScript
16 lines
319 B
TypeScript
const camelizeRE = /-(\w)/g;
|
|
|
|
export function camelize(str: string): string {
|
|
return str.replace(camelizeRE, (_, c) => c.toUpperCase());
|
|
}
|
|
|
|
export function padZero(num: number | string, targetLength = 2): string {
|
|
let str = num + '';
|
|
|
|
while (str.length < targetLength) {
|
|
str = '0' + str;
|
|
}
|
|
|
|
return str;
|
|
}
|