@@ -236,12 +236,6 @@ export function generateBindings() {
236236 '#include <nan.h>' ,
237237 '#include "../ta-lib/c/include/ta_libc.h"' ,
238238 '' ,
239- 'static const v8::Local<v8::String> inOpenName = Nan::New("Open").ToLocalChecked();' ,
240- 'static const v8::Local<v8::String> inHighName = Nan::New("High").ToLocalChecked();' ,
241- 'static const v8::Local<v8::String> inLowName = Nan::New("Low").ToLocalChecked();' ,
242- 'static const v8::Local<v8::String> inCloseName = Nan::New("Close").ToLocalChecked();' ,
243- 'static const v8::Local<v8::String> inVolumeName = Nan::New("Volume").ToLocalChecked();' ,
244- '' ,
245239 )
246240 const footer = new ContentBuilder ( )
247241 footer
@@ -253,7 +247,7 @@ export function generateBindings() {
253247 . normal ( 'return;' )
254248 . undent ( '}' )
255249 const config : TaFuncApiXml = require ( './ta_func_api.generated.json' )
256- config . FinancialFunctions . FinancialFunction . slice ( 0 ) . forEach ( ( func ) => {
250+ config . FinancialFunctions . FinancialFunction . filter ( ( func ) => ! ! func ) . forEach ( ( func ) => {
257251 const name = func . Abbreviation [ 0 ]
258252 const required : RequiredInputArgument [ ] = func . RequiredInputArguments
259253 ? func . RequiredInputArguments . reduce ( ( prev , curr ) => {
@@ -339,16 +333,17 @@ export function generateBindings() {
339333 return `${ name } = argc > ${ index } && info[${ index } ]->IsInt32() ? info[${ index } ]->Int32Value() : ${ name } ;`
340334 } ) )
341335 . undent ( '} else {' )
342- . indent ( ...doubleRequired . map ( ( argv , index ) => {
343- return `v8::Local<v8::String> ${ inName ( argv ) } Name = info[${ index + 1 } ]->ToString();`
344- } ) )
345- . normal ( ...required . map ( ( argv ) => {
346- return `v8::Local<v8::Array> ${ jsInName ( argv ) } `
347- + `= v8::Local<v8::Array>::Cast(inFirst->Get(${ inName ( argv ) } Name));`
336+ . indent ( ...required . map ( ( argv , index ) => {
337+ const ctor = doubleRequired . indexOf ( argv ) === - 1
338+ ? `Nan::New("${ argv . Type [ 0 ] } ").ToLocalChecked()`
339+ : `info[${ index + 1 } ]->ToString()`
340+ return `v8::Local<v8::String> ${ inName ( argv ) } Name = ${ ctor } ;`
348341 } ) )
342+ . normal ( `v8::Local<v8::Object> inObject;` )
349343 . normal ( 'for (i = 0; i < (uint32_t) inLength; i++) {' )
350- . indent ( ...required . map ( ( argv ) => {
351- return `${ inName ( argv ) } [i] = ${ jsInName ( argv ) } ->Get(i)->NumberValue();`
344+ . indent ( 'inObject = inFirst->Get(i)->ToObject();' )
345+ . normal ( ...required . map ( ( argv ) => {
346+ return `${ inName ( argv ) } [i] = inObject->Get(${ inName ( argv ) } Name)->NumberValue();`
352347 } ) )
353348 . undent ( '}' )
354349 . normal ( ...optional . map ( ( argv , index ) => {
0 commit comments