@@ -247,7 +247,7 @@ export function generateBindings() {
247247 . normal ( 'return;' )
248248 . undent ( '}' )
249249 const config : TaFuncApiXml = require ( './ta_func_api.generated.json' )
250- config . FinancialFunctions . FinancialFunction . filter ( ( func ) => ! ! func ) . forEach ( ( func ) => {
250+ config . FinancialFunctions . FinancialFunction . filter ( ( func ) => func . Abbreviation [ 0 ] === 'SAR' || 1 ) . forEach ( ( func ) => {
251251 const name = func . Abbreviation [ 0 ]
252252 const required : RequiredInputArgument [ ] = func . RequiredInputArguments
253253 ? func . RequiredInputArguments . reduce ( ( prev , curr ) => {
@@ -347,7 +347,7 @@ export function generateBindings() {
347347 } ) )
348348 . undent ( '}' )
349349 . normal ( ...optional . map ( ( argv , index ) => {
350- index += required . length
350+ index += 1 + doubleRequired . length
351351 const type = optType ( argv )
352352 const check = type === 'double' ? 'Number' : 'Int32'
353353 const cast = type === 'TA_MAType' ? '(TA_MAType) ' : ''
@@ -359,6 +359,10 @@ export function generateBindings() {
359359 return `${ name } = argc > ${ index } && info[${ index } ]->IsInt32() ? info[${ index } ]->Int32Value() : ${ name } ;`
360360 } ) )
361361 . undent ( '}' )
362+ . normal ( 'if (startIdx < 0 || endIdx >= inLength || startIdx > endIdx) {' )
363+ . indent ( 'Nan::ThrowRangeError("`startIdx` or `endIdx` out of range");' )
364+ . normal ( 'return;' )
365+ . undent ( '}' )
362366 . normal ( `int lookback = TA_${ name } _Lookback(${ optional . map ( ( argv ) => optName ( argv ) ) . join ( ', ' ) } );` )
363367 . normal ( 'int temp = lookback > startIdx ? lookback : startIdx;' )
364368 . normal ( 'outLength = temp > endIdx ? 0 : endIdx - temp + 1;' )
0 commit comments