Skip to content

Commit 3690b93

Browse files
committed
fix Vars
1 parent cfe0b6f commit 3690b93

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

lib/query/woqlDoc.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ function Doc(obj) {
7676
}
7777

7878
function Vars(...args) {
79-
args.forEach(function (k) {
80-
this[k] = new Var(k);
81-
});
79+
for (let i = 0, j = arguments.length; i < j; i += 1) {
80+
const argumentName = args[i];
81+
this[argumentName] = new Var(argumentName);
82+
}
83+
}
8284

83-
module.exports = { Vars, Var, Doc };
85+
module.exports = { Vars, Var, Doc };

lib/woql.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// /@ts-check
44
// I HAVE TO REVIEW THE Inheritance and the prototype chain
55
const WOQLQuery = require('./query/woqlBuilder');
6-
const { Var, Doc } = require('./query/woqlDoc');
6+
const { Vars, Var, Doc } = require('./query/woqlDoc');
77
/**
88
* @license Apache Version 2
99
* @module WOQL
@@ -1315,6 +1315,14 @@ WOQL.client = function (client) {
13151315
return this._client;
13161316
};
13171317

1318+
/**
1319+
*
1320+
* @param {...string} varNames
1321+
* @returns object
1322+
* @example
1323+
* const v = WOQL.Vars('var01', 'var02', 'var03');
1324+
* triple(v.var01, v.var02, v.var03)
1325+
*/
13181326
WOQL.Vars = function (...varNames) {
13191327
return new Vars(...varNames);
13201328
};

0 commit comments

Comments
 (0)