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);
134134
135135function findWho ( message , action ) {
136136 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)
138138 const whoNormalizeSettings = {
139139 whitespace : true , // remove hyphens, newlines, and force one space between words
140140 case : false , // keep only first-word, and 'entity' titlecasing
@@ -156,7 +156,7 @@ function findWho(message, action) {
156156
157157 if ( matchedSet . length > 0 ) {
158158 matchedText = matchedSet [ 0 ] . text ;
159- matchedText = matchedText . replace ( "#/#" , "-" ) ;
159+ matchedText = matchedText . replace ( / # \/ # / g , "-" ) ;
160160
161161 return matchedText ;
162162 }
Original file line number Diff line number Diff line change @@ -62,6 +62,17 @@ describe('parseComment', () => {
6262 } )
6363 } )
6464
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+
6576 test ( 'Basic intent to add - with plurals' , ( ) => {
6677 expect (
6778 parseComment ( `@${ testBotName } please add dat2 for docs` ) ,
You can’t perform that action at this time.
0 commit comments