From ddf3692e11fb3d774a73a02e89621a60d946e9e9 Mon Sep 17 00:00:00 2001 From: liangsky <640634387@qq.com> Date: Sat, 3 Dec 2022 15:53:12 +0800 Subject: [PATCH] feat: file name - replace to _ --- packages/grpc-mock/src/grpc/utils.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/grpc-mock/src/grpc/utils.ts b/packages/grpc-mock/src/grpc/utils.ts index 766478a..b51fe9c 100644 --- a/packages/grpc-mock/src/grpc/utils.ts +++ b/packages/grpc-mock/src/grpc/utils.ts @@ -61,11 +61,14 @@ export const firstWordNeedLetter = (str: string): string => { export const firstUpperCaseOfWord = (str: string) => { const result: string[] = []; str = firstWordNeedLetter(str); - str.split('_').forEach((item) => { - result.push( - item.toLowerCase().replace(/^\w|\s\w/g, (w) => w.toUpperCase()), - ); - }); + str + .replace(/-/gi, '_') + .split('_') + .forEach((item) => { + result.push( + item.toLowerCase().replace(/^\w|\s\w/g, (w) => w.toUpperCase()), + ); + }); return result.join(''); };