File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ nlp.plugin(plugin);
134
134
135
135
function findWho ( message , action ) {
136
136
function findWhoSafe ( match ) {
137
- message = message . replace ( "-" , "#/#" ) ; // workaround (https://github.com/spencermountain/compromise/issues/726)
137
+ message = message . replace ( / \- / g , "#/#" ) ; // workaround (https://github.com/spencermountain/compromise/issues/726)
138
138
const whoNormalizeSettings = {
139
139
whitespace : true , // remove hyphens, newlines, and force one space between words
140
140
case : false , // keep only first-word, and 'entity' titlecasing
@@ -156,7 +156,7 @@ function findWho(message, action) {
156
156
157
157
if ( matchedSet . length > 0 ) {
158
158
matchedText = matchedSet [ 0 ] . text ;
159
- matchedText = matchedText . replace ( "#/#" , "-" ) ;
159
+ matchedText = matchedText . replace ( / # \/ # / g , "-" ) ;
160
160
161
161
return matchedText ;
162
162
}
Original file line number Diff line number Diff line change @@ -62,6 +62,17 @@ describe('parseComment', () => {
62
62
} )
63
63
} )
64
64
65
+ test ( 'Basic intent to add - username with multiple dashes' , ( ) => {
66
+ expect (
67
+ parseComment ( `@${ testBotName } please add rishi-raj-jain for doc` ) ,
68
+ ) . toEqual ( {
69
+ action : 'add' ,
70
+ contributors : {
71
+ "rishi-raj-jain" : [ 'doc' ] ,
72
+ } ,
73
+ } )
74
+ } )
75
+
65
76
test ( 'Basic intent to add - with plurals' , ( ) => {
66
77
expect (
67
78
parseComment ( `@${ testBotName } please add dat2 for docs` ) ,
You can’t perform that action at this time.
0 commit comments