@nxtedition/yield 1.0.11 → 1.0.12

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.
Files changed (2) hide show
  1. package/lib/index.js +9 -5
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -45,15 +45,19 @@ export function maybeYield (
45
45
  opaque ,
46
46
  timeout ,
47
47
  ) {
48
+ if (
49
+ callbackOrTimeout != null &&
50
+ typeof callbackOrTimeout !== 'function' &&
51
+ typeof callbackOrTimeout !== 'number'
52
+ ) {
53
+ throw new TypeError('callback must be a function')
54
+ }
55
+
48
56
  const callback = typeof callbackOrTimeout === 'function' ? callbackOrTimeout : undefined
49
57
  if (timeout === undefined && typeof callbackOrTimeout === 'number') {
50
58
  timeout = callbackOrTimeout
51
59
  }
52
60
 
53
- if (callback != null && typeof callback !== 'function') {
54
- throw new TypeError('callback must be a function')
55
- }
56
-
57
61
  if (shouldYield(timeout)) {
58
62
  if (callback != null) {
59
63
  doYield(callback, opaque)
@@ -125,7 +129,7 @@ function dispatchYield() {
125
129
 
126
130
  if (yieldIndex === yieldQueue.length) {
127
131
  yieldScheduled = false
128
- yieldQueue.splice(0)
132
+ yieldQueue.length = 0
129
133
  yieldIndex = 0
130
134
  } else {
131
135
  if (yieldIndex > 16 * 1024) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/yield",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -27,5 +27,5 @@
27
27
  "rimraf": "^6.1.3",
28
28
  "typescript": "^5.9.3"
29
29
  },
30
- "gitHead": "b58c17cb0fdb8c6781ea35addb2c3b4348dba0d6"
30
+ "gitHead": "f6592f0be62fecc161237610ae6454ec6585548b"
31
31
  }