ctx-core 5.6.1 → 5.7.0

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.
@@ -7,8 +7,9 @@
7
7
  export async function promise_timeout(
8
8
  promise,
9
9
  ms,
10
- error = new Error(`Timeout ${ms}ms`),
10
+ error
11
11
  ) {
12
+ error ??= Error(`Timeout ${ms}ms`)
12
13
  let id
13
14
  let timeout = new Promise((_resolve, reject)=>{
14
15
  id = setTimeout(()=>reject(error), ms)
@@ -4,7 +4,8 @@ export declare function rmemo__wait<
4
4
  >(
5
5
  memo:_rmemo_T,
6
6
  condition_fn:(val:rmemo_val_T<_rmemo_T>)=>unknown,
7
- timeout?:number
7
+ timeout?:number,
8
+ error?:Error
8
9
  ):Promise<rmemo_val_T<_rmemo_T>>&{
9
10
  // prevent early usGC
10
11
  m:memo_T<unknown>
@@ -7,9 +7,15 @@ import { memo_ } from '../rmemo/index.js'
7
7
  * @param {rmemo_T}rmemo
8
8
  * @param {(val:unknown)=>unknown}condition_fn
9
9
  * @param {number}[timeout]
10
+ * @param {Error}[error]
10
11
  * @returns {Promise<*>|Promise<unknown>}
11
12
  */
12
- export function rmemo__wait(rmemo, condition_fn, timeout) {
13
+ export function rmemo__wait(
14
+ rmemo,
15
+ condition_fn,
16
+ timeout,
17
+ error
18
+ ) {
13
19
  let memo
14
20
  const _subscribe_wait = new Promise(resolve=>{
15
21
  memo = memo_(()=>{
@@ -20,9 +26,9 @@ export function rmemo__wait(rmemo, condition_fn, timeout) {
20
26
  memo()
21
27
  })
22
28
  let promise =
23
- isNumber_(timeout)
24
- ? promise_timeout(_subscribe_wait, timeout)
25
- : _subscribe_wait
29
+ isNumber_(timeout)
30
+ ? promise_timeout(_subscribe_wait, timeout, error)
31
+ : _subscribe_wait
26
32
  // prevent GC
27
33
  promise.m = memo
28
34
  return promise
package/package.json CHANGED
@@ -1,241 +1,240 @@
1
1
  {
2
- "name": "ctx-core",
3
- "version": "5.6.1",
4
- "description": "ctx-core core library",
5
- "keywords": [
6
- "ctx-core",
7
- "array",
8
- "combinators",
9
- "function",
10
- "object",
11
- "set"
12
- ],
13
- "homepage": "https://github.com/ctx-core/ctx-core#readme",
14
- "bugs": {
15
- "url": "https://github.com/ctx-core/ctx-core/issues"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/ctx-core/ctx-core.git"
20
- },
21
- "license": "Apache-2.0",
22
- "author": "Brian Takita",
23
- "type": "module",
24
- "files": [
25
- "*.d.ts",
26
- "*.js",
27
- "*.json",
28
- "all",
29
- "array",
30
- "atob",
31
- "base16",
32
- "be",
33
- "btoa",
34
- "buffer",
35
- "chain",
36
- "class",
37
- "cli-args",
38
- "color",
39
- "combinators",
40
- "crypto",
41
- "currency",
42
- "data",
43
- "date",
44
- "debounce",
45
- "deep_equal",
46
- "env",
47
- "error",
48
- "fetch",
49
- "fibonacci",
50
- "fs",
51
- "function",
52
- "functional",
53
- "html",
54
- "http",
55
- "math",
56
- "matrix",
57
- "number",
58
- "object",
59
- "queue",
60
- "random",
61
- "regex",
62
- "rmemo",
63
- "set",
64
- "sleep",
65
- "string",
66
- "tempfile",
67
- "test",
68
- "time",
69
- "types",
70
- "uri",
71
- "uuid",
72
- "package.json"
73
- ],
74
- "types": "./src/index.d.ts",
75
- "exports": {
76
- ".": "./index.js",
77
- "./all": "./all/index.js",
78
- "./array": "./array/index.js",
79
- "./atob": "./atob/index.js",
80
- "./base16": "./base16/index.js",
81
- "./be": "./be/index.js",
82
- "./btoa": "./btoa/index.js",
83
- "./buffer": "./buffer/index.js",
84
- "./chain": "./chain/index.js",
85
- "./class": "./class/index.js",
86
- "./cli-args": "./cli-args/index.js",
87
- "./color": "./color/index.js",
88
- "./combinators": "./combinators/index.js",
89
- "./crypto": "./crypto/index.js",
90
- "./currency": "./currency/index.js",
91
- "./data": "./data/index.js",
92
- "./date": "./date/index.js",
93
- "./debounce": "./debounce/index.js",
94
- "./deep_equal": "./deep_equal/index.js",
95
- "./env": "./env/index.js",
96
- "./error": "./error/index.js",
97
- "./fetch": "./fetch/index.js",
98
- "./fibonacci": "./fibonacci/index.js",
99
- "./fs": "./fs/index.js",
100
- "./function": "./function/index.js",
101
- "./functional": "./functional/index.js",
102
- "./html": "./html/index.js",
103
- "./http": "./http/index.js",
104
- "./math": "./math/index.js",
105
- "./matrix": "./matrix/index.js",
106
- "./number": "./number/index.js",
107
- "./object": "./object/index.js",
108
- "./queue": "./queue/index.js",
109
- "./random": "./random/index.js",
110
- "./regex": "./regex/index.js",
111
- "./rmemo": "./rmemo/index.js",
112
- "./set": "./set/index.js",
113
- "./sleep": "./sleep/index.js",
114
- "./string": "./string/index.js",
115
- "./tempfile": "./tempfile/index.js",
116
- "./test": "./test/index.js",
117
- "./time": "./time/index.js",
118
- "./types": "./types/index.js",
119
- "./uri": "./uri/index.js",
120
- "./uuid": "./uuid/index.js",
121
- "./package.json": "./package.json"
122
- },
123
- "scripts": {
124
- "build": ":",
125
- "clean": ":",
126
- "exec": "$@",
127
- "prepublishOnly": "pnpm clean && pnpm build && pnpm test",
128
- "test": "pnpm run /^test:/",
129
- "test:size": "size-limit",
130
- "test:type": "check-dts",
131
- "test:unit": "NODE_OPTIONS=--loader=esmock tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
132
- "disable:test:coverage": "c8 pnpm test:unit"
133
- },
134
- "devDependencies": {
135
- "@arethetypeswrong/cli": "^0.13.5",
136
- "@ctx-core/preprocess": "^0.1.0",
137
- "@size-limit/preset-small-lib": "^11.0.1",
138
- "@types/node": "^20.10.6",
139
- "@types/sinon": "^17.0.2",
140
- "c8": "^8.0.1",
141
- "check-dts": "^0.7.2",
142
- "esbuild": "^0.19.11",
143
- "esmock": "^2.6.0",
144
- "sinon": "^17.0.1",
145
- "size-limit": "^11.0.1",
146
- "tsx": "^4.7.0",
147
- "typescript": "next",
148
- "uvu": "^0.5.6"
149
- },
150
- "publishConfig": {
151
- "access": "public",
152
- "cache": "~/.npm"
153
- },
154
- "sideEffects": false,
155
- "size-limit": [
156
- {
157
- "name": "ctx_",
158
- "import": {
159
- "./be": "{ ctx_ }"
160
- },
161
- "limit": "33 B"
162
- },
163
- {
164
- "name": "ns_ctx_",
165
- "import": {
166
- "./be": "{ ns_ctx_ }"
167
- },
168
- "limit": "85 B"
169
- },
170
- {
171
- "name": "be_",
172
- "import": {
173
- "./be": "{ be_ }"
174
- },
175
- "limit": "99 B"
176
- },
177
- {
178
- "name": "be_ ctx_",
179
- "import": {
180
- "./be": "{ be_, ctx_ }"
181
- },
182
- "limit": "131 B"
183
- },
184
- {
185
- "name": "be_ ns_ctx_",
186
- "import": {
187
- "./be": "{ be_, ctx_, ns_ctx_ }"
188
- },
189
- "limit": "190 B"
190
- },
191
- {
192
- "name": "be_ ctx_ ns_ctx_",
193
- "import": {
194
- "./be": "{ be_, ctx_, ns_ctx_ }"
195
- },
196
- "limit": "190 B"
197
- },
198
- {
199
- "name": "memo_",
200
- "import": {
201
- "./rmemo": "{ memo_ }"
202
- },
203
- "limit": "336 B"
204
- },
205
- {
206
- "name": "memo_ sig_",
207
- "import": {
208
- "./rmemo": "{ sig_, memo_ }"
209
- },
210
- "limit": "352 B"
211
- },
212
- {
213
- "name": "memo_ sig_ be_ ctx_",
214
- "import": {
215
- "./rmemo": "{ sig_, memo_, be_, ctx_ }"
216
- },
217
- "limit": "458 B"
218
- },
219
- {
220
- "name": "memo_ sig_ be_ ctx_ be_memo_pair_ be_sig_triple_",
221
- "import": {
222
- "./rmemo": "{ sig_, memo_, be_, ctx_, be_memo_pair_, be_sig_triple_ }"
223
- },
224
- "limit": "552 B"
225
- },
226
- {
227
- "name": "uuid",
228
- "import": {
229
- "./uuid": "{ uuid_ }"
230
- },
231
- "limit": "39 B"
232
- },
233
- {
234
- "name": "short uuid",
235
- "import": {
236
- "./uuid": "{ short_uuid_ }"
237
- },
238
- "limit": "116 B"
239
- }
240
- ]
2
+ "name": "ctx-core",
3
+ "version": "5.7.0",
4
+ "description": "ctx-core core library",
5
+ "keywords": [
6
+ "ctx-core",
7
+ "array",
8
+ "combinators",
9
+ "function",
10
+ "object",
11
+ "set"
12
+ ],
13
+ "homepage": "https://github.com/ctx-core/ctx-core#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/ctx-core/ctx-core/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/ctx-core/ctx-core.git"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "author": "Brian Takita",
23
+ "type": "module",
24
+ "files": [
25
+ "*.d.ts",
26
+ "*.js",
27
+ "*.json",
28
+ "all",
29
+ "array",
30
+ "atob",
31
+ "base16",
32
+ "be",
33
+ "btoa",
34
+ "buffer",
35
+ "chain",
36
+ "class",
37
+ "cli-args",
38
+ "color",
39
+ "combinators",
40
+ "crypto",
41
+ "currency",
42
+ "data",
43
+ "date",
44
+ "debounce",
45
+ "deep_equal",
46
+ "env",
47
+ "error",
48
+ "fetch",
49
+ "fibonacci",
50
+ "fs",
51
+ "function",
52
+ "functional",
53
+ "html",
54
+ "http",
55
+ "math",
56
+ "matrix",
57
+ "number",
58
+ "object",
59
+ "queue",
60
+ "random",
61
+ "regex",
62
+ "rmemo",
63
+ "set",
64
+ "sleep",
65
+ "string",
66
+ "tempfile",
67
+ "test",
68
+ "time",
69
+ "types",
70
+ "uri",
71
+ "uuid",
72
+ "package.json"
73
+ ],
74
+ "types": "./src/index.d.ts",
75
+ "exports": {
76
+ ".": "./index.js",
77
+ "./all": "./all/index.js",
78
+ "./array": "./array/index.js",
79
+ "./atob": "./atob/index.js",
80
+ "./base16": "./base16/index.js",
81
+ "./be": "./be/index.js",
82
+ "./btoa": "./btoa/index.js",
83
+ "./buffer": "./buffer/index.js",
84
+ "./chain": "./chain/index.js",
85
+ "./class": "./class/index.js",
86
+ "./cli-args": "./cli-args/index.js",
87
+ "./color": "./color/index.js",
88
+ "./combinators": "./combinators/index.js",
89
+ "./crypto": "./crypto/index.js",
90
+ "./currency": "./currency/index.js",
91
+ "./data": "./data/index.js",
92
+ "./date": "./date/index.js",
93
+ "./debounce": "./debounce/index.js",
94
+ "./deep_equal": "./deep_equal/index.js",
95
+ "./env": "./env/index.js",
96
+ "./error": "./error/index.js",
97
+ "./fetch": "./fetch/index.js",
98
+ "./fibonacci": "./fibonacci/index.js",
99
+ "./fs": "./fs/index.js",
100
+ "./function": "./function/index.js",
101
+ "./functional": "./functional/index.js",
102
+ "./html": "./html/index.js",
103
+ "./http": "./http/index.js",
104
+ "./math": "./math/index.js",
105
+ "./matrix": "./matrix/index.js",
106
+ "./number": "./number/index.js",
107
+ "./object": "./object/index.js",
108
+ "./queue": "./queue/index.js",
109
+ "./random": "./random/index.js",
110
+ "./regex": "./regex/index.js",
111
+ "./rmemo": "./rmemo/index.js",
112
+ "./set": "./set/index.js",
113
+ "./sleep": "./sleep/index.js",
114
+ "./string": "./string/index.js",
115
+ "./tempfile": "./tempfile/index.js",
116
+ "./test": "./test/index.js",
117
+ "./time": "./time/index.js",
118
+ "./types": "./types/index.js",
119
+ "./uri": "./uri/index.js",
120
+ "./uuid": "./uuid/index.js",
121
+ "./package.json": "./package.json"
122
+ },
123
+ "devDependencies": {
124
+ "@arethetypeswrong/cli": "^0.13.5",
125
+ "@ctx-core/preprocess": "^0.1.0",
126
+ "@size-limit/preset-small-lib": "^11.0.1",
127
+ "@types/node": "^20.10.6",
128
+ "@types/sinon": "^17.0.2",
129
+ "c8": "^8.0.1",
130
+ "check-dts": "^0.7.2",
131
+ "esbuild": "^0.19.11",
132
+ "esmock": "^2.6.0",
133
+ "sinon": "^17.0.1",
134
+ "size-limit": "^11.0.1",
135
+ "tsx": "^4.7.0",
136
+ "typescript": "next",
137
+ "uvu": "^0.5.6"
138
+ },
139
+ "publishConfig": {
140
+ "access": "public",
141
+ "cache": "~/.npm"
142
+ },
143
+ "sideEffects": false,
144
+ "size-limit": [
145
+ {
146
+ "name": "ctx_",
147
+ "import": {
148
+ "./be": "{ ctx_ }"
149
+ },
150
+ "limit": "33 B"
151
+ },
152
+ {
153
+ "name": "ns_ctx_",
154
+ "import": {
155
+ "./be": "{ ns_ctx_ }"
156
+ },
157
+ "limit": "85 B"
158
+ },
159
+ {
160
+ "name": "be_",
161
+ "import": {
162
+ "./be": "{ be_ }"
163
+ },
164
+ "limit": "99 B"
165
+ },
166
+ {
167
+ "name": "be_ ctx_",
168
+ "import": {
169
+ "./be": "{ be_, ctx_ }"
170
+ },
171
+ "limit": "131 B"
172
+ },
173
+ {
174
+ "name": "be_ ns_ctx_",
175
+ "import": {
176
+ "./be": "{ be_, ctx_, ns_ctx_ }"
177
+ },
178
+ "limit": "190 B"
179
+ },
180
+ {
181
+ "name": "be_ ctx_ ns_ctx_",
182
+ "import": {
183
+ "./be": "{ be_, ctx_, ns_ctx_ }"
184
+ },
185
+ "limit": "190 B"
186
+ },
187
+ {
188
+ "name": "memo_",
189
+ "import": {
190
+ "./rmemo": "{ memo_ }"
191
+ },
192
+ "limit": "336 B"
193
+ },
194
+ {
195
+ "name": "memo_ sig_",
196
+ "import": {
197
+ "./rmemo": "{ sig_, memo_ }"
198
+ },
199
+ "limit": "352 B"
200
+ },
201
+ {
202
+ "name": "memo_ sig_ be_ ctx_",
203
+ "import": {
204
+ "./rmemo": "{ sig_, memo_, be_, ctx_ }"
205
+ },
206
+ "limit": "458 B"
207
+ },
208
+ {
209
+ "name": "memo_ sig_ be_ ctx_ be_memo_pair_ be_sig_triple_",
210
+ "import": {
211
+ "./rmemo": "{ sig_, memo_, be_, ctx_, be_memo_pair_, be_sig_triple_ }"
212
+ },
213
+ "limit": "552 B"
214
+ },
215
+ {
216
+ "name": "uuid",
217
+ "import": {
218
+ "./uuid": "{ uuid_ }"
219
+ },
220
+ "limit": "39 B"
221
+ },
222
+ {
223
+ "name": "short uuid",
224
+ "import": {
225
+ "./uuid": "{ short_uuid_ }"
226
+ },
227
+ "limit": "116 B"
228
+ }
229
+ ],
230
+ "scripts": {
231
+ "build": ":",
232
+ "clean": ":",
233
+ "exec": "$@",
234
+ "test": "pnpm run /^test:/",
235
+ "test:size": "size-limit",
236
+ "test:type": "check-dts",
237
+ "test:unit": "NODE_OPTIONS=--loader=esmock tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
238
+ "disable:test:coverage": "c8 pnpm test:unit"
239
+ }
241
240
  }