Skip to content

Commit 660a528

Browse files
committed
fix(queries): options argument to queries.read defaults to object
1 parent eab90e2 commit 660a528

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

components/queries.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99
* @param {{limit:number, start:number}} [options] - options.limit and options.start control which
1010
* @returns {Promise}
1111
*/
12-
function read (client, query, options) {
12+
function read (client, query, options = {}) {
1313
const limit = options.limit || 1
14-
const start = options.start || 1 // yes, it seems to be 1-based
15-
const queryOptions = options || {}
14+
const start = options.start || 1 // yes, start it seems to be 1-based
1615

17-
// these cause null exceptions in exist XML RPC
18-
delete queryOptions.start
19-
delete queryOptions.limit
16+
// remmove them from options as they cause NPEs in exist-db XML-RPC
17+
delete options.limit
18+
delete options.start
2019

21-
return client.promisedMethodCall('query', [query, limit, start, queryOptions])
20+
return client.promisedMethodCall('query', [query, limit, start, options])
2221
}
2322

2423
/**

0 commit comments

Comments
 (0)