FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lowcode-engine-vue/packages/renderer-core/src/utils/string.ts at main · fe-lce/lowcode-engine-vue · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
fe-lce
/
lowcode-engine-vue
Public
forked from
KNXCloud/lowcode-engine-vue
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lowcode-engine-vue
/
packages
/
renderer-core
/
src
/
utils
/
string.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (44 loc) · 1.04 KB
Breadcrumbs
lowcode-engine-vue
/
packages
/
renderer-core
/
src
/
utils
/
string.ts
Copy path
File metadata and controls
46 lines (44 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* 将驼峰命名法的字符串转化为中划线连接的字符串
*
*
@example
*
* const res = kebabCase('userName'); // user-name
*
*
@param
str - 被转换的字符串
*/
export
function
kebabCase
(
str
:
string
)
:
string
{
if
(
!
str
)
return
str
;
return
str
.
replace
(
/
[
A
-
Z
]
/
g
,
(
c
,
i
)
=>
{
const
suf
=
i
>
0
?
'-'
:
''
;
return
suf
+
c
.
toLocaleLowerCase
(
)
;
}
)
;
}
/**
* 将中划线连接的字符串转化为小驼峰命名法
*
*
@example
*
* const res = camelCase('user-name'); // userName
*
*
@param
str - 被转换的字符串
*/
export
function
camelCase
(
str
:
string
)
:
string
{
if
(
!
str
)
return
str
;
return
str
.
replace
(
/
-
[
a
-
z
A
-
Z
]
/
g
,
(
c
)
=>
{
return
c
.
charAt
(
1
)
.
toLocaleUpperCase
(
)
;
}
)
;
}
/**
* 将中划线连接的字符串转化为大驼峰命名法
*
*
@example
*
* const res = pascalCase('user-name'); // UserName
*
*
@param
str - 被转换的字符串
*/
export
function
pascalCase
(
str
:
string
)
:
string
{
const
res
=
camelCase
(
str
)
;
return
res
&&
res
.
charAt
(
0
)
.
toLocaleUpperCase
(
)
+
res
.
slice
(
1
)
;
}
Back
|
FazBrowse Home
|
New Git URL