@@ -60,7 +60,7 @@ const toMaxLen = (input, maxLength) => {
6060 return negative ? ( '-' + input ) : input ;
6161} ;
6262
63- const toSequence = ( parts , options ) => {
63+ const toSequence = ( parts , options , maxLen ) => {
6464 parts . negatives . sort ( ( a , b ) => a < b ? - 1 : a > b ? 1 : 0 ) ;
6565 parts . positives . sort ( ( a , b ) => a < b ? - 1 : a > b ? 1 : 0 ) ;
6666
@@ -70,11 +70,11 @@ const toSequence = (parts, options) => {
7070 let result ;
7171
7272 if ( parts . positives . length ) {
73- positives = parts . positives . join ( '|' ) ;
73+ positives = parts . positives . map ( v => toMaxLen ( String ( v ) , maxLen ) ) . join ( '|' ) ;
7474 }
7575
7676 if ( parts . negatives . length ) {
77- negatives = `-(${ prefix } ${ parts . negatives . join ( '|' ) } )` ;
77+ negatives = `-(${ prefix } ${ parts . negatives . map ( v => toMaxLen ( String ( v ) , maxLen ) ) . join ( '|' ) } )` ;
7878 }
7979
8080 if ( positives && negatives ) {
@@ -172,7 +172,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
172172
173173 if ( options . toRegex === true ) {
174174 return step > 1
175- ? toSequence ( parts , options )
175+ ? toSequence ( parts , options , maxLen )
176176 : toRegex ( range , null , { wrap : false , ...options } ) ;
177177 }
178178
@@ -184,7 +184,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
184184 return invalidRange ( start , end , options ) ;
185185 }
186186
187-
188187 let format = options . transform || ( val => String . fromCharCode ( val ) ) ;
189188 let a = `${ start } ` . charCodeAt ( 0 ) ;
190189 let b = `${ end } ` . charCodeAt ( 0 ) ;
0 commit comments