Skip to content

Commit 638dc18

Browse files
committed
Fix issue with listUntil helper function
1 parent 3001b54 commit 638dc18

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Http.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Http {
3434
throw Error.internal("The 'sort' parameter was not of type SortOptions.");
3535
}
3636

37-
if (!sort.isUnset()) endpoint += sort.toQueryString();
37+
if (sort.isSet()) endpoint += sort.toQueryString();
3838
await this.#throttler.stallIfRequired(false);
3939

4040
try {
@@ -134,8 +134,8 @@ class Http {
134134
*
135135
* @return {Array<object>} An array of raw objects.
136136
*/
137-
async listUntil(endpoint, shouldContinue, sort) {
138-
if (!(typeof endpoint !== "string")) {
137+
async listUntil(endpoint, shouldContinue, sort = new SortOptions()) {
138+
if (typeof endpoint !== "string") {
139139
throw Error.internal("The 'endpoint' parameter was not a string.");
140140
} else if (!(sort instanceof SortOptions)) {
141141
throw Error.internal("The 'sort' parameter was not of type SortOptions.");

src/SortOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SortOptions {
3131
*
3232
* @returns {bool} Whether or not any sort options have been set.
3333
*/
34-
isUnset() {
34+
isSet() {
3535
return this.sort || this.order || this.page;
3636
}
3737
}

0 commit comments

Comments
 (0)