Skip to content

Commit 57c3048

Browse files
Convert arrays in WOQL.doc (#191)
Fixes #190
1 parent 1870caf commit 57c3048

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/query/woqlDoc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function convert(obj) {
4040
'@type': 'Value',
4141
variable: obj.name,
4242
};
43-
} if (typeof (obj) === 'object') {
43+
} if (typeof (obj) === 'object' && !Array.isArray(obj)) {
4444
const pairs = [];
4545
// eslint-disable-next-line no-restricted-syntax
4646
for (const [key, value] of Object.entries(obj)) {
@@ -57,6 +57,12 @@ function convert(obj) {
5757
data: pairs,
5858
},
5959
};
60+
} if (typeof (obj) === 'object' && Array.isArray(obj)) {
61+
const list = obj.map(convert);
62+
return {
63+
'@type': 'Value',
64+
list,
65+
};
6066
}
6167
}
6268

0 commit comments

Comments
 (0)