@nxtedition/yield 1.0.8 → 1.0.9
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/README.md +3 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -21,9 +21,8 @@ import { maybeYield } from '@nxtedition/yield'
|
|
|
21
21
|
import { DatabaseSync } from 'node:sqlite'
|
|
22
22
|
|
|
23
23
|
const db = new DatabaseSync('data.db')
|
|
24
|
-
const rows = db.prepare('SELECT * FROM large_table').all()
|
|
25
24
|
|
|
26
|
-
for (const row of
|
|
25
|
+
for (const row of db.prepare('SELECT * FROM large_table').iterate()) {
|
|
27
26
|
processRow(row)
|
|
28
27
|
const yielded = maybeYield()
|
|
29
28
|
if (yielded) {
|
|
@@ -66,12 +65,12 @@ doYield((opaque) => {
|
|
|
66
65
|
### Checking without yielding
|
|
67
66
|
|
|
68
67
|
```js
|
|
69
|
-
import { shouldYield } from '@nxtedition/yield'
|
|
68
|
+
import { shouldYield, doYield } from '@nxtedition/yield'
|
|
70
69
|
|
|
71
70
|
while (hasWork()) {
|
|
72
71
|
doWork()
|
|
73
72
|
if (shouldYield()) {
|
|
74
|
-
|
|
73
|
+
doMoreWork()
|
|
75
74
|
break
|
|
76
75
|
}
|
|
77
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/yield",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -26,5 +26,6 @@
|
|
|
26
26
|
"oxlint-tsgolint": "^0.12.2",
|
|
27
27
|
"rimraf": "^6.1.2",
|
|
28
28
|
"typescript": "^5.9.3"
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "f2075fe03da821af3a69721f4d1d7a27d864b115"
|
|
30
31
|
}
|