File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
- const gitmojis : Record < string , string > = {
1
+ export const gitmojis : Record < string , string > = {
2
2
":art:" : "🎨" ,
3
3
":zap:" : "⚡️" ,
4
4
":fire:" : "🔥" ,
@@ -72,22 +72,25 @@ const gitmojis: Record<string, string> = {
72
72
":technologist:" : "🧑💻" ,
73
73
":money_with_wings:" : "💸" ,
74
74
":thread:" : "🧵" ,
75
- ":safety_vest:" : "🦺"
75
+ ":safety_vest:" : "🦺" ,
76
76
} ;
77
77
78
- export function convert ( content : string , withSpace ?: boolean | "leading" | "trailing" | "both" ) {
78
+ export function convert (
79
+ content : string ,
80
+ withSpace ?: boolean | "leading" | "trailing" | "both"
81
+ ) {
79
82
const re = new RegExp ( Object . keys ( gitmojis ) . join ( "|" ) , "gi" ) ;
80
83
return content . replace ( re , function ( matched ) {
81
84
switch ( withSpace ) {
82
85
case true :
83
86
case "trailing" :
84
- return `${ gitmojis [ matched . toLowerCase ( ) ] } `
87
+ return `${ gitmojis [ matched . toLowerCase ( ) ] } ` ;
85
88
case "leading" :
86
- return ` ${ gitmojis [ matched . toLowerCase ( ) ] } `
89
+ return ` ${ gitmojis [ matched . toLowerCase ( ) ] } ` ;
87
90
case "both" :
88
- return ` ${ gitmojis [ matched . toLowerCase ( ) ] } `
91
+ return ` ${ gitmojis [ matched . toLowerCase ( ) ] } ` ;
89
92
default :
90
- return gitmojis [ matched . toLowerCase ( ) ]
93
+ return gitmojis [ matched . toLowerCase ( ) ] ;
91
94
}
92
95
} ) ;
93
96
}
You can’t perform that action at this time.
0 commit comments