Skip to content

Commit cb0f25c

Browse files
committed
Remove ArrayCursor#some/every
1 parent aae4d2b commit cb0f25c

File tree

2 files changed

+9
-35
lines changed

2 files changed

+9
-35
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ This is a major release and breaks backwards compatibility.
6262
The underlying collection can still be accessed from the `collection`
6363
property.
6464

65+
- Removed `cursor.some` and `cursor.every`
66+
67+
These methods encouraged overfetching and should be replaced with more
68+
efficient AQL queries.
69+
70+
The behavior can still be implemented by using the `next` method directly
71+
or iterating over the cursor using the `forEach` method or the `for await`
72+
syntax.
73+
6574
### Deprecated
6675

6776
- Deprecated `db.useDatabase`

src/cursor.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -232,41 +232,6 @@ export class ArrayCursor<T = any> {
232232
return true;
233233
}
234234

235-
async every(
236-
fn: (value: T, index: number, self: ArrayCursor<T>) => boolean
237-
): Promise<boolean> {
238-
let index = 0;
239-
while (this._result.length || this.hasMore) {
240-
let result;
241-
while (this._result.length) {
242-
result = fn(this._result.shift()!, index, this);
243-
index++;
244-
if (!result) return false;
245-
}
246-
if (this.hasMore) await this._more();
247-
}
248-
return true;
249-
}
250-
251-
/**
252-
* TODO
253-
*/
254-
async some(
255-
fn: (value: T, index: number, self: ArrayCursor<T>) => boolean
256-
): Promise<boolean> {
257-
let index = 0;
258-
while (this._result.length || this.hasMore) {
259-
let result;
260-
while (this._result.length) {
261-
result = fn(this._result.shift()!, index, this);
262-
index++;
263-
if (result) return true;
264-
}
265-
if (this.hasMore) await this._more();
266-
}
267-
return false;
268-
}
269-
270235
/**
271236
* TODO
272237
*/

0 commit comments

Comments
 (0)