Skip to content

Commit 75d081c

Browse files
authored
fix: Faulty error thrown by ProgramCall.addParam (#124)
When ProgramCall.addParam is passed a DS (2D array) the second parameter is an optional object for parm options. addParam(data, [,options]) Latest code in master throws an error when passing an DS and no options object to ProgramCall.addParam. `Error: Specifying the parameter type is required.` An error should not be thrown if a DS is passed to addParam without providing the option object.
1 parent 739cb47 commit 75d081c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/ProgramCall.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ class ProgramCall {
4040
addParam(data, type, options, inDs = null) {
4141
let opt;
4242
// DS element has no 'type', so if the second param 'type' is an Object, then it is the options.
43-
if (typeof type === 'object') {
43+
if (Array.isArray(data)) {
4444
opt = type;
4545
} else {
4646
opt = options;
47-
if (!type) {
47+
if (type === undefined) {
4848
throw new Error('Specifying the parameter type is required.');
4949
}
5050
}
51-
5251
if (!inDs) { // In recursive mode, if it is an element in DS, then no <parm> or </parm> needed.
5352
this.xml += '<parm';
5453
if (opt && typeof opt === 'object') { // append <param> options

0 commit comments

Comments
 (0)