1
- /* eslint-disable no-ex-assign */
2
- /* eslint-disable no-throw-literal */
3
1
// @ts -check
4
2
'use strict'
5
3
@@ -118,6 +116,7 @@ const defaultMethods = {
118
116
throw : ( type ) => {
119
117
if ( Array . isArray ( type ) ) type = type [ 0 ]
120
118
if ( typeof type === 'object' ) throw type
119
+ // eslint-disable-next-line no-throw-literal
121
120
throw { type }
122
121
} ,
123
122
max : ( data ) => Math . max ( ...data ) ,
@@ -388,6 +387,7 @@ const defaultMethods = {
388
387
try {
389
388
res = buildState . compile `((context, above) => { try { return ${ data [ 0 ] } } catch(err) { above = [null, context, above]; context = { type: err.type || err.message || err.toString() }; `
390
389
} catch ( err ) {
390
+ // eslint-disable-next-line no-ex-assign
391
391
if ( Number . isNaN ( err ) ) err = { type : 'NaN' }
392
392
res = { [ Compiled ] : `((context, above) => { { above = [null, context, above]; context = ${ JSON . stringify ( err ) } ; ` }
393
393
}
@@ -398,6 +398,7 @@ const defaultMethods = {
398
398
if ( i === data . length - 1 ) res = buildState . compile `${ res } try { return ${ data [ i ] } } catch(err) { throw err; } `
399
399
else res = buildState . compile `${ res } try { return ${ data [ i ] } } catch(err) { context = { type: err.type || err.message || err.toString() }; } `
400
400
} catch ( err ) {
401
+ // eslint-disable-next-line no-ex-assign
401
402
if ( Number . isNaN ( err ) ) err = { type : 'NaN' }
402
403
if ( i === data . length - 1 ) res = buildState . compile `${ res } throw ${ { [ Compiled ] : JSON . stringify ( err ) } } `
403
404
else res = buildState . compile `${ res } ${ { [ Compiled ] : `context = ${ JSON . stringify ( err ) } ;` } } `
0 commit comments