@@ -10,13 +10,13 @@ const {hasOwnProperty} = Object.prototype;
1010/* eslint prefer-named-capture-group: "off" */
1111
1212const FENCE_BLOCK_REGEXP = / ^ ( ( [ \t ] * ` { 3 , 4 } ) ( [ ^ \n ] * ) ( [ \s \S ] + ?) ( ^ [ \t ] * \2) ) / gm;
13- const CODE_BLOCK_REGEXP = / ( ` (? ! [ \\ ] ) ) ( (?: .(? ! \1(? ! [ \\ ] ) ) ) * .? ) \1/ g;
13+ const CODE_BLOCK_REGEXP = / ( ` (? ! \\ ) ) ( (?: .(? ! \1(? ! \\ ) ) ) * .? ) \1/ g;
1414const HTML_CODE_BLOCK_REGEXP = / ( < c o d e ) + ?( (? ! ( < c o d e | < \/ c o d e > ) + ?) [ \S \s ] ) * ( < \/ c o d e > ) + ?/ gim;
1515const LEADING_TRAILING_SLASH_REGEXP = / ^ \/ ? ( [ ^ / ] + (?: \/ [ ^ / ] + ) * ) \/ ? $ / ;
1616const TRAILING_SLASH_REGEXP = / \/ ? $ / ;
1717
18- function inverse ( str ) {
19- return str
18+ function inverse ( string ) {
19+ return string
2020 . split ( '' )
2121 . reverse ( )
2222 . join ( '' ) ;
@@ -37,8 +37,8 @@ function addTrailingSlash(value) {
3737 return value . replace ( TRAILING_SLASH_REGEXP , '/' ) ;
3838}
3939
40- function includesIgnoreCase ( arr , value ) {
41- return arr . findIndex ( val => val . toUpperCase ( ) === value . toUpperCase ( ) ) > - 1 ;
40+ function includesIgnoreCase ( array , value ) {
41+ return array . findIndex ( arrayValue => arrayValue . toUpperCase ( ) === value . toUpperCase ( ) ) > - 1 ;
4242}
4343
4444function buildMentionsRegexp ( { mentionsPrefixes} ) {
@@ -53,11 +53,11 @@ function buildRefRegexp({actions, delimiters, issuePrefixes, issueURLSegments, h
5353 } ((?:(?:[\\w-\\.]+)\\/)+(?:[\\w-\\.]+))?(${ join ( [ ...issuePrefixes , ...issueURLSegments ] ) } )(\\d+)(?!\\w)`;
5454}
5555
56- function buildRegexp ( opts ) {
56+ function buildRegexp ( options ) {
5757 return new RegExp (
58- opts . mentionsPrefixes . length > 0
59- ? `(?:${ buildRefRegexp ( opts ) } |${ buildMentionsRegexp ( opts ) } )`
60- : buildMentionsRegexp ( opts ) ,
58+ options . mentionsPrefixes . length > 0
59+ ? `(?:${ buildRefRegexp ( options ) } |${ buildMentionsRegexp ( options ) } )`
60+ : buildMentionsRegexp ( options ) ,
6161 'gim'
6262 ) ;
6363}
@@ -122,24 +122,24 @@ function typeError(parentOpt, opt) {
122122 ) ;
123123}
124124
125- function normalize ( opts , parentOpt ) {
126- for ( const opt of Object . keys ( opts ) ) {
125+ function normalize ( options , parentOpt ) {
126+ for ( const opt of Object . keys ( options ) ) {
127127 if ( ! parentOpt && opt === 'actions' ) {
128- normalize ( opts [ opt ] , opt ) ;
128+ normalize ( options [ opt ] , opt ) ;
129129 } else {
130- if ( ! opts [ opt ] ) {
131- opts [ opt ] = [ ] ;
132- } else if ( isString ( opts [ opt ] ) ) {
133- opts [ opt ] = [ opts [ opt ] ] ;
134- } else if ( ! Array . isArray ( opts [ opt ] ) ) {
130+ if ( ! options [ opt ] ) {
131+ options [ opt ] = [ ] ;
132+ } else if ( isString ( options [ opt ] ) ) {
133+ options [ opt ] = [ options [ opt ] ] ;
134+ } else if ( ! Array . isArray ( options [ opt ] ) ) {
135135 throw typeError ( parentOpt , opt ) ;
136136 }
137137
138- if ( opts [ opt ] . length !== 0 && ! opts [ opt ] . every ( opt => isString ( opt ) ) ) {
138+ if ( options [ opt ] . length !== 0 && ! options [ opt ] . every ( opt => isString ( opt ) ) ) {
139139 throw typeError ( parentOpt , opt ) ;
140140 }
141141
142- opts [ opt ] = opts [ opt ] . filter ( Boolean ) ;
142+ options [ opt ] = options [ opt ] . filter ( Boolean ) ;
143143 }
144144 }
145145}
@@ -165,27 +165,27 @@ module.exports = (options = 'default', overrides = {}) => {
165165
166166 options = isString ( options ) ? hostConfig [ options . toLowerCase ( ) ] : options ;
167167
168- const opts = {
168+ const mergedOptions = {
169169 ...hostConfig . default ,
170170 ...options ,
171171 ...overrides ,
172172 actions : { ...hostConfig . default . actions , ...options . actions , ...overrides . actions } ,
173173 } ;
174174
175- normalize ( opts ) ;
175+ normalize ( mergedOptions ) ;
176176
177- opts . hosts = opts . hosts . map ( addTrailingSlash ) ;
178- opts . issueURLSegments = opts . issueURLSegments . map ( addLeadingAndTrailingSlash ) ;
177+ mergedOptions . hosts = mergedOptions . hosts . map ( addTrailingSlash ) ;
178+ mergedOptions . issueURLSegments = mergedOptions . issueURLSegments . map ( addLeadingAndTrailingSlash ) ;
179179
180- const regexp = buildRegexp ( opts ) ;
181- const mentionRegexp = buildMentionRegexp ( opts ) ;
180+ const regexp = buildRegexp ( mergedOptions ) ;
181+ const mentionRegexp = buildMentionRegexp ( mergedOptions ) ;
182182
183183 return text => {
184184 if ( ! isString ( text ) ) {
185185 throw new TypeError ( 'The issue text must be a String' ) ;
186186 }
187187
188- const results = parse ( text , regexp , mentionRegexp , opts ) ;
188+ const results = parse ( text , regexp , mentionRegexp , mergedOptions ) ;
189189
190190 Reflect . defineProperty ( results , 'allRefs' , {
191191 get ( ) {
0 commit comments