File tree Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Expand file tree Collapse file tree 1 file changed +1
-15
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ function build (schema, options) {
1818 ${ $asNumber . toString ( ) }
1919 ${ $asNull . toString ( ) }
2020 ${ $asBoolean . toString ( ) }
21- ${ $asRegExp . toString ( ) }
2221 `
2322 var main
2423
@@ -79,27 +78,14 @@ function $asString (str) {
7978 if ( str instanceof Date ) {
8079 return '"' + str . toISOString ( ) + '"'
8180 } else if ( str instanceof RegExp ) {
82- return $asRegExp ( str )
81+ str = str . source
8382 } else if ( typeof str !== 'string' ) {
8483 str = str . toString ( )
8584 }
8685
8786 return JSON . stringify ( str )
8887}
8988
90- function $asRegExp ( reg ) {
91- reg = reg . source
92-
93- for ( var i = 0 , len = reg . length ; i < len ; i ++ ) {
94- if ( reg [ i ] === '\\' || reg [ i ] === '"' ) {
95- reg = reg . substring ( 0 , i ) + '\\' + reg . substring ( i ++ )
96- len += 2
97- }
98- }
99-
100- return '"' + reg + '"'
101- }
102-
10389function addPatternProperties ( schema , externalSchema ) {
10490 var pp = schema . patternProperties
10591 let code = `
You can’t perform that action at this time.
0 commit comments