chore: move utils

This commit is contained in:
chenjiahan
2020-07-05 08:32:49 +08:00
parent 0a4c6676ba
commit 12faaa2179
20 changed files with 776 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
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;
}