@onyx.dev/onyx-database 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -239,12 +239,26 @@ declare class QueryResults<T> extends Array<T> {
|
|
|
239
239
|
/**
|
|
240
240
|
* Iterates over each record on the current page only.
|
|
241
241
|
* @param action - Function to invoke for each record.
|
|
242
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
242
243
|
* @example
|
|
243
244
|
* ```ts
|
|
244
245
|
* results.forEachOnPage(u => console.log(u.id));
|
|
245
246
|
* ```
|
|
246
247
|
*/
|
|
247
|
-
forEachOnPage(action: (item: T) => void): void;
|
|
248
|
+
forEachOnPage(action: (item: T, index: number, array: QueryResults<T>) => void, thisArg?: unknown): void;
|
|
249
|
+
/**
|
|
250
|
+
* Iterates over every record across all pages sequentially.
|
|
251
|
+
* @param action - Function executed for each record. Returning `false`
|
|
252
|
+
* stops iteration early.
|
|
253
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* await results.forEach(u => {
|
|
257
|
+
* console.log(u.id);
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
forEach(action: (item: T, index: number, array: T[]) => void, thisArg?: unknown): Promise<void>;
|
|
248
262
|
/**
|
|
249
263
|
* Iterates over every record across all pages sequentially.
|
|
250
264
|
* @param action - Function executed for each record. Returning `false`
|
package/dist/index.d.ts
CHANGED
|
@@ -239,12 +239,26 @@ declare class QueryResults<T> extends Array<T> {
|
|
|
239
239
|
/**
|
|
240
240
|
* Iterates over each record on the current page only.
|
|
241
241
|
* @param action - Function to invoke for each record.
|
|
242
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
242
243
|
* @example
|
|
243
244
|
* ```ts
|
|
244
245
|
* results.forEachOnPage(u => console.log(u.id));
|
|
245
246
|
* ```
|
|
246
247
|
*/
|
|
247
|
-
forEachOnPage(action: (item: T) => void): void;
|
|
248
|
+
forEachOnPage(action: (item: T, index: number, array: QueryResults<T>) => void, thisArg?: unknown): void;
|
|
249
|
+
/**
|
|
250
|
+
* Iterates over every record across all pages sequentially.
|
|
251
|
+
* @param action - Function executed for each record. Returning `false`
|
|
252
|
+
* stops iteration early.
|
|
253
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* await results.forEach(u => {
|
|
257
|
+
* console.log(u.id);
|
|
258
|
+
* });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
forEach(action: (item: T, index: number, array: T[]) => void, thisArg?: unknown): Promise<void>;
|
|
248
262
|
/**
|
|
249
263
|
* Iterates over every record across all pages sequentially.
|
|
250
264
|
* @param action - Function executed for each record. Returning `false`
|
package/dist/index.js
CHANGED
|
@@ -580,13 +580,36 @@ var QueryResults = class extends Array {
|
|
|
580
580
|
/**
|
|
581
581
|
* Iterates over each record on the current page only.
|
|
582
582
|
* @param action - Function to invoke for each record.
|
|
583
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
583
584
|
* @example
|
|
584
585
|
* ```ts
|
|
585
586
|
* results.forEachOnPage(u => console.log(u.id));
|
|
586
587
|
* ```
|
|
587
588
|
*/
|
|
588
|
-
forEachOnPage(action) {
|
|
589
|
-
|
|
589
|
+
forEachOnPage(action, thisArg) {
|
|
590
|
+
super.forEach((value, index) => {
|
|
591
|
+
action.call(thisArg, value, index, this);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Iterates over every record across all pages sequentially.
|
|
596
|
+
* @param action - Function executed for each record. Returning `false`
|
|
597
|
+
* stops iteration early.
|
|
598
|
+
* @param thisArg - Optional `this` binding for the callback.
|
|
599
|
+
* @example
|
|
600
|
+
* ```ts
|
|
601
|
+
* await results.forEach(u => {
|
|
602
|
+
* console.log(u.id);
|
|
603
|
+
* });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
forEach(action, thisArg) {
|
|
607
|
+
let index = 0;
|
|
608
|
+
return this.forEachAll(async (item) => {
|
|
609
|
+
const result = await action.call(thisArg, item, index, this);
|
|
610
|
+
index += 1;
|
|
611
|
+
return result;
|
|
612
|
+
});
|
|
590
613
|
}
|
|
591
614
|
/**
|
|
592
615
|
* Iterates over every record across all pages sequentially.
|