File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -571,12 +571,8 @@ function buildArray (context, location) {
571571 `
572572 }
573573
574- if ( largeArrayMechanism !== 'default' ) {
575- if ( largeArrayMechanism === 'json-stringify' ) {
576- functionCode += `if (arrayLength && arrayLength >= ${ largeArraySize } ) return JSON.stringify(obj)\n`
577- } else {
578- throw new Error ( `Unsupported large array mechanism ${ largeArrayMechanism } ` )
579- }
574+ if ( largeArrayMechanism === 'json-stringify' ) {
575+ functionCode += `if (arrayLength && arrayLength >= ${ largeArraySize } ) return JSON.stringify(obj)\n`
580576 }
581577
582578 functionCode += `
@@ -663,8 +659,6 @@ function buildArrayTypeCondition (type, accessor) {
663659 return buildArrayTypeCondition ( subType , accessor )
664660 } )
665661 condition = `(${ conditions . join ( ' || ' ) } )`
666- } else {
667- throw new Error ( `${ type } unsupported` )
668662 }
669663 }
670664 return condition
Original file line number Diff line number Diff line change @@ -35,6 +35,18 @@ test('render a float as an integer', (t) => {
3535 }
3636} )
3737
38+ test ( 'throws on NaN' , ( t ) => {
39+ t . plan ( 1 )
40+
41+ const schema = {
42+ title : 'integer' ,
43+ type : 'integer'
44+ }
45+
46+ const stringify = build ( schema )
47+ t . throws ( ( ) => stringify ( NaN ) , new Error ( 'The value "NaN" cannot be converted to an integer.' ) )
48+ } )
49+
3850test ( 'render a float as an integer' , ( t ) => {
3951 const cases = [
4052 { input : Math . PI , output : '3' } ,
You can’t perform that action at this time.
0 commit comments