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) {
571
571
`
572
572
}
573
573
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`
580
576
}
581
577
582
578
functionCode += `
@@ -663,8 +659,6 @@ function buildArrayTypeCondition (type, accessor) {
663
659
return buildArrayTypeCondition ( subType , accessor )
664
660
} )
665
661
condition = `(${ conditions . join ( ' || ' ) } )`
666
- } else {
667
- throw new Error ( `${ type } unsupported` )
668
662
}
669
663
}
670
664
return condition
Original file line number Diff line number Diff line change @@ -35,6 +35,18 @@ test('render a float as an integer', (t) => {
35
35
}
36
36
} )
37
37
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
+
38
50
test ( 'render a float as an integer' , ( t ) => {
39
51
const cases = [
40
52
{ input : Math . PI , output : '3' } ,
You can’t perform that action at this time.
0 commit comments