ctx-core 5.1.0 → 5.2.1
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/all/CACHE_VERSION/index.d.ts +10 -0
- package/all/CACHE_VERSION/index.js +14 -0
- package/all/NODE_ENV/index.d.ts +10 -0
- package/all/NODE_ENV/index.js +14 -0
- package/all/Request/index.js +2 -1
- package/all/Response/index.js +1 -1
- package/all/VERSION/index.d.ts +7 -0
- package/all/VERSION/index.js +12 -0
- package/all/add/index.js +1 -1
- package/all/all_union_a/index.js +1 -1
- package/all/and/index.js +2 -1
- package/all/andand_or/index.js +2 -1
- package/all/andandfn/index.js +4 -3
- package/all/apply/index.js +4 -2
- package/all/arg_a__pick/index.d.ts +6 -0
- package/all/arg_a__pick/index.js +16 -0
- package/all/arg_i0_a/index.js +3 -2
- package/all/assign_fn_key_a/index.js +1 -1
- package/all/bad_gateway/index.js +2 -1
- package/all/bad_request/index.js +1 -1
- package/all/be/index.js +3 -2
- package/all/be_/index.d.ts +38 -3
- package/all/be_/index.js +52 -14
- package/all/be_/index.test.ts +191 -90
- package/all/be_lock_memosig_triple/index.test.ts +6 -6
- package/all/be_memo_pair/index.test.ts +4 -4
- package/all/be_memosig_triple/index.test.ts +6 -6
- package/all/be_sig_triple/index.test.ts +4 -4
- package/all/binary_sort_rank/index.js +2 -1
- package/all/bind_apply/index.js +4 -4
- package/all/bind_call/index.js +1 -1
- package/all/bind_map_apply/index.js +1 -1
- package/all/bind_map_call/index.js +4 -5
- package/all/btoa/index.js +2 -1
- package/all/btoa_Uint32Array/index.js +2 -1
- package/all/call/index.js +2 -1
- package/all/call_assign/index.js +2 -1
- package/all/chain/index.js +3 -2
- package/all/clone_assign_fn_key_a/index.js +2 -1
- package/all/color_hsv_phi_rgb_a/index.js +3 -2
- package/all/color_invert_rgb_a/index.js +3 -2
- package/all/compact_a_ctx/index.js +2 -1
- package/all/compare/index.js +2 -1
- package/all/compose/index.js +5 -5
- package/all/concat_truthy_a/index.js +4 -2
- package/all/console__error/index.js +2 -1
- package/all/crypto__sign/index.js +2 -1
- package/all/currency_str/index.js +2 -1
- package/all/currency_symbol/index.js +2 -1
- package/all/curry/index.js +2 -2
- package/all/date/index.js +1 -1
- package/all/default_arg_a/index.d.ts +11 -0
- package/all/default_arg_a/index.js +41 -0
- package/all/dfn_flag_r/index.d.ts +8 -0
- package/all/dfn_flag_r/index.js +24 -0
- package/all/difference_a/index.js +4 -2
- package/all/each/index.js +2 -1
- package/all/ensure__refresh/index.js +3 -2
- package/all/eq/index.js +5 -3
- package/all/eql_fn_a/index.js +1 -1
- package/all/error__print/index.js +4 -2
- package/all/error_o/index.js +4 -2
- package/all/falsy__none/index.js +2 -1
- package/all/fetch/index.js +2 -1
- package/all/fetch__template_pair/index.js +2 -1
- package/all/fetch_method/index.js +2 -1
- package/all/fetch_response_pair/index.js +4 -2
- package/all/filter/index.js +2 -1
- package/all/filter_o/index.js +3 -2
- package/all/find/index.js +1 -1
- package/all/flag_a/index.d.ts +6 -0
- package/all/flag_a/index.js +13 -0
- package/all/flag_r/index.d.ts +8 -0
- package/all/flag_r/index.js +34 -0
- package/all/flag_r__pick/index.d.ts +11 -0
- package/all/flag_r__pick/index.js +31 -0
- package/all/flag_r_arg_a/index.d.ts +9 -0
- package/all/flag_r_arg_a/index.js +27 -0
- package/all/flag_r_param_name/index.d.ts +9 -0
- package/all/flag_r_param_name/index.js +24 -0
- package/all/flag_regex/index.d.ts +1 -0
- package/all/flag_regex/index.js +1 -0
- package/all/flatten/index.js +7 -7
- package/all/flip/index.js +3 -2
- package/all/head_arg_a/index.js +3 -2
- package/all/headers/index.js +1 -1
- package/all/hex__digest/index.js +2 -1
- package/all/hmac/index.js +2 -1
- package/all/hmac_key/index.js +2 -1
- package/all/html/index.d.ts +0 -1
- package/all/html/index.js +0 -4
- package/all/html_attr/index.d.ts +0 -2
- package/all/html_attr/index.js +0 -2
- package/all/html_attrs/index.d.ts +0 -1
- package/all/html_attrs/index.js +0 -1
- package/all/html_class/index.d.ts +0 -2
- package/all/html_class/index.js +0 -2
- package/all/html_dataset__data_attrs/index.d.ts +0 -1
- package/all/html_dataset__data_attrs/index.js +0 -1
- package/all/html_style/index.d.ts +0 -2
- package/all/html_style/index.js +0 -2
- package/all/html_style__assign/index.d.ts +2 -6
- package/all/html_style__assign/index.js +0 -5
- package/all/html_styles_o/index.d.ts +0 -5
- package/all/html_styles_o/index.js +0 -5
- package/all/http_error/index.js +4 -2
- package/all/idx/index.js +2 -1
- package/all/idx_filter/index.js +2 -2
- package/all/idx_key_r/index.js +5 -4
- package/all/idx_reject/index.js +1 -1
- package/all/idx_sort_a__sort_idx_o/index.js +2 -1
- package/all/import_meta_env/index.d.ts +10 -0
- package/all/import_meta_env/index.js +18 -0
- package/all/index.d.ts +22 -0
- package/all/index.js +22 -0
- package/all/intersection_a/index.js +4 -2
- package/all/intersection_by/index.js +2 -1
- package/all/invalid_state/index.js +2 -2
- package/all/is_development/index.d.ts +6 -0
- package/all/is_development/index.js +9 -0
- package/all/is_production/index.d.ts +9 -0
- package/all/is_production/index.js +12 -0
- package/all/is_staging/index.d.ts +9 -0
- package/all/is_staging/index.js +12 -0
- package/all/item_r_idx/index.js +2 -1
- package/all/js_html/index.d.ts +0 -4
- package/all/js_html/index.js +0 -4
- package/all/left_and/index.js +2 -1
- package/all/left_or/index.js +2 -1
- package/all/line__parse/index.js +2 -3
- package/all/line__transform_stream/index.js +1 -1
- package/all/links_html/index.d.ts +0 -5
- package/all/links_html/index.js +0 -4
- package/all/many_andand/index.js +4 -2
- package/all/many_andand_or/index.js +6 -3
- package/all/map/index.js +1 -1
- package/all/map_andand/index.js +1 -1
- package/all/map_andand_or/index.js +3 -2
- package/all/map_andandfn/index.js +2 -1
- package/all/map_apply/index.js +2 -1
- package/all/map_call/index.js +3 -2
- package/all/map_find/index.js +1 -1
- package/all/map_obj/index.js +3 -2
- package/all/map_obj_andand/index.js +1 -1
- package/all/missing_argument/index.js +3 -2
- package/all/missing_env__throw/index.d.ts +8 -0
- package/all/missing_env__throw/index.js +19 -0
- package/all/money_str/index.js +2 -2
- package/all/neq/index.js +2 -1
- package/all/not/index.js +4 -3
- package/all/not_found/index.js +1 -1
- package/all/nullish__none/index.js +1 -1
- package/all/nullish__not_all/index.js +1 -1
- package/all/number__count/index.js +2 -2
- package/all/o_a_present/index.js +1 -1
- package/all/one_andand/index.js +2 -1
- package/all/one_andand_or/index.js +3 -2
- package/all/or/index.js +2 -3
- package/all/or_null/index.js +2 -1
- package/all/param_dfn/index.d.ts +1 -0
- package/all/param_dfn/index.js +1 -0
- package/all/param_dfn_a_reducer/index.d.ts +9 -0
- package/all/param_dfn_a_reducer/index.js +12 -0
- package/all/param_dfn_split_regex/index.d.ts +1 -0
- package/all/param_dfn_split_regex/index.js +1 -0
- package/all/param_name_r_param_val_a/index.d.ts +11 -0
- package/all/param_name_r_param_val_a/index.js +29 -0
- package/all/param_r/index.d.ts +16 -0
- package/all/param_r/index.js +33 -0
- package/all/param_r/index.test.ts +28 -0
- package/all/parseFloat_andor/index.d.ts +3 -2
- package/all/parseFloat_andor/index.test.ts +1 -1
- package/all/promise_o/index.js +2 -1
- package/all/rank/index.js +2 -1
- package/all/reduce/index.js +1 -1
- package/all/reject/index.js +1 -1
- package/all/response_o/index.js +2 -3
- package/all/right_and/index.js +2 -1
- package/all/right_or/index.js +2 -1
- package/all/rmemo/index.d.ts +1 -0
- package/all/slice_arg_a/index.js +3 -2
- package/all/slice_arg_spread_a/index.js +3 -2
- package/all/sort/index.js +1 -1
- package/all/sort_a/index.js +1 -1
- package/all/sort_idx_a/index.js +1 -1
- package/all/sort_idx_o/index.js +5 -4
- package/all/sort_val_a/index.js +1 -1
- package/all/sort_val_a__transition_idx_a/index.js +1 -3
- package/all/spread/index.js +1 -1
- package/all/spread_slice/index.js +2 -1
- package/all/tap/index.js +1 -1
- package/all/tempfile_path/index.test.ts +1 -1
- package/all/unauthorized/index.js +1 -1
- package/all/unformat_currency_str/index.js +1 -2
- package/all/union_a/index.js +3 -2
- package/all/union_by/index.js +1 -1
- package/all/url__join/index.js +2 -1
- package/all/weak_r/index.js +1 -1
- package/all/wrap_a/index.js +8 -5
- package/all/wrap_aa/index.js +3 -2
- package/all/wrap_concat/index.js +4 -3
- package/all/zip_with/index.js +1 -1
- package/cli-args/index.d.ts +14 -0
- package/cli-args/index.js +14 -0
- package/env/index.d.ts +8 -0
- package/env/index.js +8 -0
- package/html/index.d.ts +31 -0
- package/html/index.js +31 -0
- package/package.json +13 -7
package/all/be_/index.test.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { preprocess } from '@ctx-core/preprocess'
|
|
2
|
+
import { build } from 'esbuild'
|
|
3
|
+
import { readFile, unlink } from 'fs/promises'
|
|
4
|
+
import { tmpdir } from 'os'
|
|
5
|
+
import { dirname, join, resolve } from 'path'
|
|
1
6
|
import { test } from 'uvu'
|
|
2
7
|
import { equal, is, throws } from 'uvu/assert'
|
|
3
8
|
import {
|
|
@@ -8,14 +13,17 @@ import {
|
|
|
8
13
|
be_map__find,
|
|
9
14
|
type BeMapO,
|
|
10
15
|
type Ctx,
|
|
16
|
+
ctx__clear,
|
|
11
17
|
ctx__delete,
|
|
12
18
|
ctx__set,
|
|
13
19
|
type Ctx_s_T,
|
|
14
20
|
type Ctx_s_wide_T,
|
|
15
21
|
type Ctx_wide_T,
|
|
16
|
-
globalThis__be_
|
|
22
|
+
globalThis__be_,
|
|
23
|
+
ondelete_be_
|
|
17
24
|
} from '../be_/index.js'
|
|
18
25
|
import { ctx_, ctx__new, ns_ctx__new } from '../ctx/index.js'
|
|
26
|
+
import { tempfile_path_ } from '../tempfile_path/index.js'
|
|
19
27
|
import { Equal, Expect } from '../test/index.js'
|
|
20
28
|
test.after(()=>{
|
|
21
29
|
delete (globalThis as { root_be?:Be<unknown> }).root_be
|
|
@@ -41,11 +49,11 @@ test('be_|s|BeMap', ()=>{
|
|
|
41
49
|
root_(ctx) + child_(ctx),
|
|
42
50
|
{ id: 'child1_' })
|
|
43
51
|
equal(root_(ctx), 1)
|
|
44
|
-
equal(ctx.s[''].get('root_'), 1)
|
|
52
|
+
equal(ctx.s[''].get('root_')![0], 1)
|
|
45
53
|
equal(child_(ctx), 3)
|
|
46
|
-
equal(ctx.s[''].get('child_'), 3)
|
|
54
|
+
equal(ctx.s[''].get('child_')![0], 3)
|
|
47
55
|
equal(child1_(ctx), 4)
|
|
48
|
-
equal(ctx.s[''].get('child1_'), 4)
|
|
56
|
+
equal(ctx.s[''].get('child1_')![0], 4)
|
|
49
57
|
})
|
|
50
58
|
test('be_|ns_ctx__new|-ns', ()=>{
|
|
51
59
|
const ctx0 = ctx__new()
|
|
@@ -65,7 +73,7 @@ test('be_|ns_ctx__new|-ns', ()=>{
|
|
|
65
73
|
equal(ctx0.s[''].has(child_.id), true)
|
|
66
74
|
equal(ctx1.s[''].has(child_.id), false)
|
|
67
75
|
})
|
|
68
|
-
test('be_|
|
|
76
|
+
test('be_|ns_ctx__new', ()=>{
|
|
69
77
|
const ctx0 = ctx__new()
|
|
70
78
|
const ctx1 = ctx__new()
|
|
71
79
|
const ctx2 = ctx__new()
|
|
@@ -162,58 +170,87 @@ test('be_|Ctx generic type', ()=>{
|
|
|
162
170
|
test('be_|Ctx|ns', ()=>{
|
|
163
171
|
const ctx0 = ctx__new()
|
|
164
172
|
const ctx1 = ctx__new()
|
|
165
|
-
ctx1.s[''].set('matching', true)
|
|
166
173
|
const ctx = ns_ctx__new(ctx0, ctx1)
|
|
167
174
|
const nested__ctx_ = be_<[Ctx]>(ctx=>
|
|
168
175
|
[ctx],
|
|
169
176
|
{ id: 'nested__ctx_' })
|
|
170
177
|
equal(nested__ctx_(ctx), [ctx])
|
|
171
178
|
})
|
|
172
|
-
test('be_|circular dependency', ()=>{
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
test('be_|circular dependency|DEBUG=1', async ()=>{
|
|
180
|
+
const dir = dirname(new URL(import.meta.url).pathname)
|
|
181
|
+
const source = await readFile(
|
|
182
|
+
resolve(join(dir, '../be_/index.js'))
|
|
183
|
+
).then(buf=>'' + buf)
|
|
184
|
+
const preprocessed_source = preprocess(
|
|
185
|
+
source,
|
|
186
|
+
{ DEBUG: '1' },
|
|
187
|
+
{ type: 'js' })
|
|
188
|
+
const tempfile = await tempfile_path_(tmpdir(), 'js')
|
|
189
|
+
try {
|
|
190
|
+
await build({
|
|
191
|
+
stdin: {
|
|
192
|
+
contents: preprocessed_source,
|
|
193
|
+
loader: 'js',
|
|
194
|
+
resolveDir: dir,
|
|
195
|
+
},
|
|
196
|
+
outfile: tempfile,
|
|
197
|
+
})
|
|
198
|
+
const { be_: _be_ }:{ be_:typeof be_ } = await import(tempfile)
|
|
199
|
+
const be0:Be<symbol> = _be_(ctx=>
|
|
200
|
+
be1(ctx))
|
|
201
|
+
const be1:Be<symbol> = _be_(ctx=>
|
|
202
|
+
be0(ctx))
|
|
203
|
+
const ctx = ctx__new()
|
|
204
|
+
equal(be0(ctx), 'cir')
|
|
205
|
+
equal(be1(ctx), 'cir')
|
|
206
|
+
} finally {
|
|
207
|
+
await unlink(tempfile)
|
|
208
|
+
}
|
|
178
209
|
})
|
|
179
210
|
test('ctx__set', ()=>{
|
|
180
211
|
const ctx0 = ns_ctx__new('ctx0')
|
|
181
212
|
const ctx1 = ctx__new()
|
|
182
|
-
const
|
|
183
|
-
ctx__set(
|
|
213
|
+
const ns_ctx = ns_ctx__new(ctx1, ctx0)
|
|
214
|
+
ctx__set(ns_ctx, 'key', 2, 'ctx0')
|
|
184
215
|
// @ts-expect-error TS7053
|
|
185
216
|
equal(ctx0.s[''], undefined)
|
|
186
|
-
equal(ctx0.s['ctx0'].get('key'), 2)
|
|
217
|
+
equal(ctx0.s['ctx0'].get('key')![0], 2)
|
|
187
218
|
equal(ctx1.s[''].has('key'), false)
|
|
188
|
-
ctx__set(
|
|
219
|
+
ctx__set(ns_ctx, 'key', 1)
|
|
189
220
|
// @ts-expect-error TS7053
|
|
190
221
|
equal(ctx0.s[''], undefined)
|
|
191
|
-
equal(ctx0.s['ctx0'].get('key'), 2)
|
|
192
|
-
equal(ctx1.s[''].get('key'), 1)
|
|
222
|
+
equal(ctx0.s['ctx0'].get('key')![0], 2)
|
|
223
|
+
equal(ctx1.s[''].get('key')![0], 1)
|
|
193
224
|
})
|
|
194
225
|
test('ctx__delete|id', ()=>{
|
|
195
226
|
const ctx0 = ctx__new()
|
|
196
|
-
|
|
227
|
+
const key_ = be_(()=>
|
|
228
|
+
true,
|
|
229
|
+
{ id: 'key' })
|
|
230
|
+
ctx__delete(ctx0, key_)
|
|
197
231
|
equal(ctx0.s[''].has('key'), false)
|
|
198
|
-
ctx0
|
|
199
|
-
equal(ctx0.s[''].get('key'), true)
|
|
200
|
-
ctx__delete(ctx0,
|
|
232
|
+
key_(ctx0)
|
|
233
|
+
equal(ctx0.s[''].get('key')![0], true)
|
|
234
|
+
ctx__delete(ctx0, key_)
|
|
201
235
|
equal(ctx0.s[''].has('key'), false)
|
|
202
236
|
const ctx1 = ctx__new()
|
|
203
|
-
const
|
|
204
|
-
ctx0
|
|
205
|
-
ctx1
|
|
206
|
-
equal(ctx0.s[''].get('key'), true)
|
|
207
|
-
equal(ctx1.s[''].get('key'), true)
|
|
208
|
-
ctx__delete(
|
|
237
|
+
const ns_ctx = ns_ctx__new(ctx0, ctx1, 'test_ns')
|
|
238
|
+
key_(ctx0)
|
|
239
|
+
key_(ctx1)
|
|
240
|
+
equal(ctx0.s[''].get('key')![0], true)
|
|
241
|
+
equal(ctx1.s[''].get('key')![0], true)
|
|
242
|
+
ctx__delete(ns_ctx, key_)
|
|
209
243
|
equal(ctx0.s[''].has('key'), false)
|
|
210
244
|
equal(ctx1.s[''].has('key'), true)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
245
|
+
const ns_key_ = be_(()=>
|
|
246
|
+
true,
|
|
247
|
+
{ id: 'key', ns: 'test_ns' })
|
|
248
|
+
ns_key_(ns_ctx)
|
|
249
|
+
equal(ns_ctx.s['test_ns'].get('key')![0], true)
|
|
250
|
+
ctx__delete(ns_ctx, 'key')
|
|
251
|
+
equal(ns_ctx.s['test_ns'].get('key')![0], true)
|
|
252
|
+
ctx__delete(ns_ctx, 'key', 'test_ns')
|
|
253
|
+
equal(ns_ctx.s['test_ns'].has('key'), false)
|
|
217
254
|
})
|
|
218
255
|
test('ctx__delete|be', ()=>{
|
|
219
256
|
const ctx0 = ctx__new()
|
|
@@ -250,107 +287,171 @@ test('ctx__delete|be', ()=>{
|
|
|
250
287
|
equal(ctx0.s[''].has(num_.id), false)
|
|
251
288
|
// @ts-expect-error TS7053
|
|
252
289
|
equal(ctx1.s[''], undefined)
|
|
253
|
-
const
|
|
290
|
+
const ns__num_ =
|
|
254
291
|
be_(()=>1,
|
|
255
292
|
{ ns: 'ctx1' })
|
|
256
|
-
|
|
293
|
+
ns__num_(ns_ctx)
|
|
257
294
|
// @ts-expect-error TS2345
|
|
258
|
-
equal(ctx0.s[''].has(
|
|
295
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
259
296
|
// @ts-expect-error TS7053
|
|
260
297
|
equal(ctx1.s[''], undefined)
|
|
261
|
-
equal(ctx1.s['ctx1'].has(
|
|
262
|
-
ctx__delete(ns_ctx,
|
|
298
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), true)
|
|
299
|
+
ctx__delete(ns_ctx, ns__num_)
|
|
263
300
|
// @ts-expect-error TS2345
|
|
264
|
-
equal(ctx0.s[''].has(
|
|
301
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
265
302
|
// @ts-expect-error TS7053
|
|
266
303
|
equal(ctx1.s[''], undefined)
|
|
267
|
-
equal(ctx1.s['ctx1'].has(
|
|
268
|
-
|
|
304
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), false)
|
|
305
|
+
ns__num_(ns_ctx)
|
|
269
306
|
// @ts-expect-error TS2345
|
|
270
|
-
equal(ctx0.s[''].has(
|
|
307
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
271
308
|
// @ts-expect-error TS7053
|
|
272
309
|
equal(ctx1.s[''], undefined)
|
|
273
|
-
equal(ctx1.s['ctx1'].has(
|
|
274
|
-
ctx__delete(ns_ctx,
|
|
310
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), true)
|
|
311
|
+
ctx__delete(ns_ctx, ns__num_)
|
|
275
312
|
// @ts-expect-error TS2345
|
|
276
|
-
equal(ctx0.s[''].has(
|
|
313
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
277
314
|
// @ts-expect-error TS7053
|
|
278
315
|
equal(ctx1.s[''], undefined)
|
|
279
|
-
equal(ctx1.s['ctx1'].has(
|
|
280
|
-
|
|
316
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), false)
|
|
317
|
+
ns__num_(ns_ctx)
|
|
281
318
|
// @ts-expect-error TS2345
|
|
282
|
-
equal(ctx0.s[''].has(
|
|
319
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
283
320
|
// @ts-expect-error TS7053
|
|
284
321
|
equal(ctx1.s[''], undefined)
|
|
285
|
-
equal(ctx1.s['ctx1'].has(
|
|
286
|
-
ctx__delete(ns_ctx,
|
|
322
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), true)
|
|
323
|
+
ctx__delete(ns_ctx, ns__num_, '')
|
|
287
324
|
// @ts-expect-error TS2345
|
|
288
|
-
equal(ctx0.s[''].has(
|
|
325
|
+
equal(ctx0.s[''].has(ns__num_.id), false)
|
|
289
326
|
// @ts-expect-error TS7053
|
|
290
327
|
equal(ctx1.s[''], undefined)
|
|
291
|
-
equal(ctx1.s['ctx1'].has(
|
|
328
|
+
equal(ctx1.s['ctx1'].has(ns__num_.id), true)
|
|
292
329
|
})
|
|
293
330
|
test('be__has_', ()=>{
|
|
294
331
|
const ctx0 = ctx__new()
|
|
332
|
+
const key_ = be_(()=>
|
|
333
|
+
true,
|
|
334
|
+
{ id: 'key' })
|
|
295
335
|
ctx__delete(ctx0, 'key')
|
|
296
336
|
equal(be__has_('key', ctx0), false)
|
|
297
|
-
ctx0
|
|
337
|
+
key_(ctx0)
|
|
298
338
|
equal(be__has_('key', ctx0), true)
|
|
299
339
|
ctx__delete(ctx0, 'key')
|
|
300
340
|
equal(be__has_('key', ctx0), false)
|
|
301
341
|
const ctx1 = ctx__new()
|
|
302
|
-
const
|
|
303
|
-
ctx1
|
|
304
|
-
equal(be__has_('key',
|
|
305
|
-
equal(be__has_('key',
|
|
306
|
-
ctx0
|
|
307
|
-
equal(be__has_('key',
|
|
308
|
-
equal(be__has_('key',
|
|
309
|
-
|
|
310
|
-
|
|
342
|
+
const ns_ctx = ns_ctx__new(ctx0, ctx1, 'test_ns')
|
|
343
|
+
key_(ctx1)
|
|
344
|
+
equal(be__has_('key', ns_ctx), false)
|
|
345
|
+
equal(be__has_('key', ns_ctx, 'test_ns'), false)
|
|
346
|
+
key_(ctx0)
|
|
347
|
+
equal(be__has_('key', ns_ctx), true)
|
|
348
|
+
equal(be__has_('key', ns_ctx, 'test_ns'), false)
|
|
349
|
+
const ns_key_ = be_(()=>
|
|
350
|
+
true,
|
|
351
|
+
{ id: 'key', ns: 'test_ns' })
|
|
352
|
+
ns_key_(ns_ctx)
|
|
353
|
+
equal(be__has_('key', ns_ctx, 'test_ns'), true)
|
|
311
354
|
})
|
|
312
355
|
test('be_map__find', ()=>{
|
|
313
356
|
const ctx0 = ctx__new()
|
|
314
357
|
const be_map0 = ctx0.s['']
|
|
358
|
+
const key_ = be_(()=>
|
|
359
|
+
true,
|
|
360
|
+
{ id: 'key' })
|
|
315
361
|
ctx__delete(ctx0, 'key')
|
|
316
362
|
equal(be_map__find('key', ctx0), undefined)
|
|
317
|
-
ctx0
|
|
363
|
+
key_(ctx0)
|
|
318
364
|
equal(be_map__find('key', ctx0), be_map0)
|
|
319
365
|
ctx__delete(ctx0, 'key')
|
|
320
366
|
equal(be_map__find('key', ctx0), undefined)
|
|
321
367
|
const ctx1 = ctx__new()
|
|
322
368
|
const be_map1 = ctx1.s['']
|
|
323
|
-
const
|
|
324
|
-
is.not(
|
|
325
|
-
is.not(
|
|
326
|
-
ctx1
|
|
327
|
-
equal(be_map__find('key',
|
|
328
|
-
equal(be_map__find('key',
|
|
329
|
-
ctx0
|
|
330
|
-
equal(be_map__find('key',
|
|
331
|
-
equal(be_map__find('key',
|
|
332
|
-
|
|
333
|
-
|
|
369
|
+
const ns_ctx = ns_ctx__new(ctx0, ctx1, 'test_ns')
|
|
370
|
+
is.not(ns_ctx.s.test_ns, be_map0)
|
|
371
|
+
is.not(ns_ctx.s.test_ns, be_map1)
|
|
372
|
+
key_(ctx1)
|
|
373
|
+
equal(be_map__find('key', ns_ctx), undefined)
|
|
374
|
+
equal(be_map__find('key', ns_ctx, 'test_ns'), undefined)
|
|
375
|
+
key_(ctx0)
|
|
376
|
+
equal(be_map__find('key', ns_ctx), be_map0)
|
|
377
|
+
equal(be_map__find('key', ns_ctx, 'test_ns'), undefined)
|
|
378
|
+
const ns_key_ = be_(()=>
|
|
379
|
+
true,
|
|
380
|
+
{ id: 'key', ns: 'test_ns' })
|
|
381
|
+
ns_key_(ns_ctx)
|
|
382
|
+
equal(be_map__find('key', ns_ctx, 'test_ns'), ns_ctx.s.test_ns)
|
|
334
383
|
})
|
|
335
384
|
test('be__val_', ()=>{
|
|
336
385
|
const ctx0 = ctx__new()
|
|
337
386
|
const ctx1 = ctx__new()
|
|
338
|
-
const
|
|
339
|
-
const val_ = be_
|
|
387
|
+
const ns_ctx = ns_ctx__new(ctx0, ctx1, 'test_ns')
|
|
388
|
+
const val_ = be_(()=>
|
|
340
389
|
true,
|
|
341
390
|
{ id: 'val_' })
|
|
342
|
-
equal(val_(
|
|
343
|
-
equal(
|
|
344
|
-
equal(be__val_(val_,
|
|
345
|
-
equal(be__val_('val_',
|
|
346
|
-
ctx__set(
|
|
347
|
-
equal(val_(
|
|
348
|
-
equal(be__val_(val_,
|
|
349
|
-
equal(be__val_('val_',
|
|
350
|
-
equal(be__val_(val_,
|
|
351
|
-
equal(be__val_('val_',
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
391
|
+
equal(val_(ns_ctx), true)
|
|
392
|
+
equal(ns_ctx.s[''].get(val_.id)![0], true)
|
|
393
|
+
equal(be__val_(val_, ns_ctx), true)
|
|
394
|
+
equal(be__val_('val_', ns_ctx), true)
|
|
395
|
+
ctx__set(ns_ctx, val_, false)
|
|
396
|
+
equal(val_(ns_ctx), false)
|
|
397
|
+
equal(be__val_(val_, ns_ctx), false)
|
|
398
|
+
equal(be__val_('val_', ns_ctx), false)
|
|
399
|
+
equal(be__val_(val_, ns_ctx, 'test_ns'), undefined)
|
|
400
|
+
equal(be__val_('val_', ns_ctx, 'test_ns'), undefined)
|
|
401
|
+
const ns_val_ = be_(()=>
|
|
402
|
+
true,
|
|
403
|
+
{ id: 'val_', ns: 'test_ns' })
|
|
404
|
+
ns_val_(ns_ctx)
|
|
405
|
+
equal(be__val_(val_, ns_ctx, 'test_ns'), true)
|
|
406
|
+
equal(be__val_('val_', ns_ctx, 'test_ns'), true)
|
|
407
|
+
})
|
|
408
|
+
test('ondelete_be_', ()=>{
|
|
409
|
+
const ondelete0_arg_aa:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>][] = []
|
|
410
|
+
const ondelete1_arg_aa:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>][] = []
|
|
411
|
+
const _ondelete0 = (...arg_a:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>])=>
|
|
412
|
+
ondelete0_arg_aa.push(arg_a)
|
|
413
|
+
const _ondelete1 = (...arg_a:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>])=>
|
|
414
|
+
ondelete1_arg_aa.push(arg_a)
|
|
415
|
+
const be =
|
|
416
|
+
ondelete_be_<number>((ctx, { ondelete })=>{
|
|
417
|
+
ondelete(_ondelete0)
|
|
418
|
+
ondelete(_ondelete1)
|
|
419
|
+
return 1
|
|
420
|
+
})
|
|
421
|
+
const ctx = ctx__new()
|
|
422
|
+
equal(be(ctx), 1)
|
|
423
|
+
equal(ondelete0_arg_aa, [])
|
|
424
|
+
equal(ondelete1_arg_aa, [])
|
|
425
|
+
ctx__delete(ctx, be)
|
|
426
|
+
equal(ondelete0_arg_aa, [[1, ctx, be]])
|
|
427
|
+
equal(ondelete1_arg_aa, [[1, ctx, be]])
|
|
428
|
+
})
|
|
429
|
+
test('ctx__clear', ()=>{
|
|
430
|
+
const ondelete0_arg_aa:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>][] = []
|
|
431
|
+
const ondelete1_arg_aa:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>][] = []
|
|
432
|
+
const _ondelete0 = (...arg_a:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>])=>
|
|
433
|
+
ondelete0_arg_aa.push(arg_a)
|
|
434
|
+
const _ondelete1 = (...arg_a:[val:number, ctx:Ctx, be:Be<number, ''|'test_ns'>])=>
|
|
435
|
+
ondelete1_arg_aa.push(arg_a)
|
|
436
|
+
const be0 =
|
|
437
|
+
ondelete_be_<number>((ctx, { ondelete })=>{
|
|
438
|
+
ondelete(_ondelete0)
|
|
439
|
+
ondelete(_ondelete1)
|
|
440
|
+
return 1
|
|
441
|
+
})
|
|
442
|
+
const be1 =
|
|
443
|
+
ondelete_be_<number, 'test_ns'>((ctx, { ondelete })=>{
|
|
444
|
+
ondelete(_ondelete0)
|
|
445
|
+
ondelete(_ondelete1)
|
|
446
|
+
return 1
|
|
447
|
+
}, { ns: 'test_ns' })
|
|
448
|
+
const ctx = ns_ctx__new('', 'test_ns')
|
|
449
|
+
equal(be0(ctx), 1)
|
|
450
|
+
equal(be1(ctx), 1)
|
|
451
|
+
equal(ondelete0_arg_aa, [])
|
|
452
|
+
equal(ondelete1_arg_aa, [])
|
|
453
|
+
ctx__clear(ctx)
|
|
454
|
+
equal(ondelete0_arg_aa, [[1, ctx, be0], [1, ctx, be1]])
|
|
455
|
+
equal(ondelete1_arg_aa, [[1, ctx, be0], [1, ctx, be1]])
|
|
355
456
|
})
|
|
356
457
|
test.run()
|
|
@@ -78,14 +78,14 @@ test('be_lock_memosig_triple_|+id|+ns', ()=>{
|
|
|
78
78
|
equal(foobar$_(ctx)._, 2)
|
|
79
79
|
equal(foobar_(ctx), 2)
|
|
80
80
|
equal(subscriber_count, 1)
|
|
81
|
-
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 2)
|
|
81
|
+
equal((ctx.s['test_ns'].get('foobar')![0] as sig_T<number>)._, 2)
|
|
82
82
|
equal(subscriber_dep_(ctx), 3)
|
|
83
83
|
foobar__set(ns_ctx__new(ctx__new(), ctx), 5)
|
|
84
84
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
85
85
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
86
86
|
equal(foobar$_(ctx)._, 5)
|
|
87
87
|
equal(foobar_(ctx), 5)
|
|
88
|
-
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 5)
|
|
88
|
+
equal((ctx.s['test_ns'].get('foobar')![0] as sig_T<number>)._, 5)
|
|
89
89
|
equal(subscriber_count, 2)
|
|
90
90
|
equal(subscriber_dep_(ctx), 7)
|
|
91
91
|
base__set(ctx, 2)
|
|
@@ -94,7 +94,7 @@ test('be_lock_memosig_triple_|+id|+ns', ()=>{
|
|
|
94
94
|
equal(foobar$_(ctx)._, 5)
|
|
95
95
|
equal(foobar_(ctx), 5)
|
|
96
96
|
equal(subscriber_count, 2)
|
|
97
|
-
equal((ctx.s['test_ns'].get('foobar') as sig_T<number>)._, 5)
|
|
97
|
+
equal((ctx.s['test_ns'].get('foobar')![0] as sig_T<number>)._, 5)
|
|
98
98
|
equal(subscriber_dep_(ctx), 7)
|
|
99
99
|
})
|
|
100
100
|
test('be_lock_memosig_triple_|+be', ()=>{
|
|
@@ -130,7 +130,7 @@ test('be_lock_memosig_triple_|+be', ()=>{
|
|
|
130
130
|
equal(foobar$_(ctx)._, 2)
|
|
131
131
|
equal(foobar_(ctx), 2)
|
|
132
132
|
equal(subscriber_count, 1)
|
|
133
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
133
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 2)
|
|
134
134
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
135
135
|
foobar__set(ctx, 5)
|
|
136
136
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
@@ -138,14 +138,14 @@ test('be_lock_memosig_triple_|+be', ()=>{
|
|
|
138
138
|
equal(foobar$_(ctx)._, 5)
|
|
139
139
|
equal(foobar_(ctx), 5)
|
|
140
140
|
equal(subscriber_count, 2)
|
|
141
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
141
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 5)
|
|
142
142
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
143
143
|
base__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
144
144
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
145
145
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
146
146
|
equal(foobar$_(ctx)._, 3)
|
|
147
147
|
equal(foobar_(ctx), 3)
|
|
148
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
148
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 3)
|
|
149
149
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
150
150
|
equal(subscriber_count, 3)
|
|
151
151
|
})
|
|
@@ -69,7 +69,7 @@ test('be_memo_pair_|+id|+ns|+oninit|+subscriber_a', ()=>{
|
|
|
69
69
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
70
70
|
equal(foobar$_(ctx)._, 2)
|
|
71
71
|
equal(foobar_(ctx), 2)
|
|
72
|
-
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 2)
|
|
72
|
+
equal((ctx.s.test_ns.get('foobar')![0] as memo_T<number>)._, 2)
|
|
73
73
|
equal(subscriber_count, 1)
|
|
74
74
|
equal(subscriber_dep_(ctx), 3)
|
|
75
75
|
base__set(ctx, 2)
|
|
@@ -77,7 +77,7 @@ test('be_memo_pair_|+id|+ns|+oninit|+subscriber_a', ()=>{
|
|
|
77
77
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
78
78
|
equal(foobar$_(ctx)._, 3)
|
|
79
79
|
equal(foobar_(ctx), 3)
|
|
80
|
-
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 3)
|
|
80
|
+
equal((ctx.s.test_ns.get('foobar')![0] as memo_T<number>)._, 3)
|
|
81
81
|
equal(subscriber_count, 2)
|
|
82
82
|
equal(subscriber_dep_(ctx), 5)
|
|
83
83
|
})
|
|
@@ -138,7 +138,7 @@ test('be_memo_pair_|be', ()=>{
|
|
|
138
138
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
139
139
|
equal(foobar$_(ctx)._, 2)
|
|
140
140
|
equal(foobar_(ctx), 2)
|
|
141
|
-
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 2)
|
|
141
|
+
equal((ctx.s.test_ns.get('foobar')![0] as memo_T<number>)._, 2)
|
|
142
142
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
143
143
|
equal(subscriber_count, 1)
|
|
144
144
|
base__set(ctx, 2)
|
|
@@ -146,7 +146,7 @@ test('be_memo_pair_|be', ()=>{
|
|
|
146
146
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
147
147
|
equal(foobar$_(ctx)._, 3)
|
|
148
148
|
equal(foobar_(ctx), 3)
|
|
149
|
-
equal((ctx.s.test_ns.get('foobar') as memo_T<number>)._, 3)
|
|
149
|
+
equal((ctx.s.test_ns.get('foobar')![0] as memo_T<number>)._, 3)
|
|
150
150
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
151
151
|
equal(subscriber_count, 1)
|
|
152
152
|
})
|
|
@@ -81,14 +81,14 @@ test('be_memosig_triple_|+id|+ns', ()=>{
|
|
|
81
81
|
equal(foobar$_(ctx)._, 2)
|
|
82
82
|
equal(foobar_(ctx), 2)
|
|
83
83
|
equal(subscriber_count, 1)
|
|
84
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
84
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 2)
|
|
85
85
|
equal(subscriber_dep_(ctx), 3)
|
|
86
86
|
foobar__set(ns_ctx__new(ctx__new(), ctx), 5)
|
|
87
87
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
88
88
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 5)
|
|
89
89
|
equal(foobar$_(ctx)._, 5)
|
|
90
90
|
equal(foobar_(ctx), 5)
|
|
91
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
91
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 5)
|
|
92
92
|
equal(subscriber_count, 2)
|
|
93
93
|
equal(subscriber_dep_(ctx), 7)
|
|
94
94
|
base__set(ctx, 2)
|
|
@@ -97,7 +97,7 @@ test('be_memosig_triple_|+id|+ns', ()=>{
|
|
|
97
97
|
equal(foobar$_(ctx)._, 3)
|
|
98
98
|
equal(foobar_(ctx), 3)
|
|
99
99
|
equal(subscriber_count, 3)
|
|
100
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
100
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 3)
|
|
101
101
|
equal(subscriber_dep_(ctx), 6)
|
|
102
102
|
})
|
|
103
103
|
test('be_memosig_triple_|+be', ()=>{
|
|
@@ -133,7 +133,7 @@ test('be_memosig_triple_|+be', ()=>{
|
|
|
133
133
|
equal(foobar$_(ctx)._, 2)
|
|
134
134
|
equal(foobar_(ctx), 2)
|
|
135
135
|
equal(subscriber_count, 1)
|
|
136
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
136
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 2)
|
|
137
137
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
138
138
|
foobar__set(ctx, 5)
|
|
139
139
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 5)
|
|
@@ -141,14 +141,14 @@ test('be_memosig_triple_|+be', ()=>{
|
|
|
141
141
|
equal(foobar$_(ctx)._, 5)
|
|
142
142
|
equal(foobar_(ctx), 5)
|
|
143
143
|
equal(subscriber_count, 2)
|
|
144
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 5)
|
|
144
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 5)
|
|
145
145
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
146
146
|
base__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
147
147
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 3)
|
|
148
148
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 3)
|
|
149
149
|
equal(foobar$_(ctx)._, 3)
|
|
150
150
|
equal(foobar_(ctx), 3)
|
|
151
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 3)
|
|
151
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 3)
|
|
152
152
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
153
153
|
equal(subscriber_count, 3)
|
|
154
154
|
})
|
|
@@ -55,13 +55,13 @@ test('be_sig_triple_|+id|+ns', ()=>{
|
|
|
55
55
|
equal(foobar_(ctx), 1)
|
|
56
56
|
equal(subscriber_count, 1)
|
|
57
57
|
equal(subscriber_dep_(ctx), 2)
|
|
58
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 1)
|
|
58
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 1)
|
|
59
59
|
foobar__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
60
60
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
61
61
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
62
62
|
equal(foobar$_(ctx)._, 2)
|
|
63
63
|
equal(foobar_(ctx), 2)
|
|
64
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
64
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 2)
|
|
65
65
|
equal(subscriber_count, 2)
|
|
66
66
|
equal(subscriber_dep_(ctx), 4)
|
|
67
67
|
})
|
|
@@ -88,14 +88,14 @@ test('be_sig_triple_|+be', ()=>{
|
|
|
88
88
|
equal(foobar$_(ctx)._, 1)
|
|
89
89
|
equal(foobar_(ctx), 1)
|
|
90
90
|
equal(subscriber_count, 1)
|
|
91
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 1)
|
|
91
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 1)
|
|
92
92
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
93
93
|
foobar__set(ns_ctx__new(ctx__new(), ctx), 2)
|
|
94
94
|
equal(foobar$_(ns_ctx__new(ctx__new(), ctx))._, 2)
|
|
95
95
|
equal(foobar_(ns_ctx__new(ctx__new(), ctx)), 2)
|
|
96
96
|
equal(foobar$_(ctx)._, 2)
|
|
97
97
|
equal(foobar_(ctx), 2)
|
|
98
|
-
equal((ctx.s.test_ns.get('foobar') as sig_T<number>)._, 2)
|
|
98
|
+
equal((ctx.s.test_ns.get('foobar')![0] as sig_T<number>)._, 2)
|
|
99
99
|
equal(foobar$_(ctx).custom, 'custom-val')
|
|
100
100
|
equal(subscriber_count, 1)
|
|
101
101
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="../array_types/index.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* Returns the rank of the item where the compare function === 0, using binarySort
|
|
3
4
|
* @param {unknown[]}a
|
|
4
|
-
* @param {
|
|
5
|
+
* @param {compare_1_T}compare_1
|
|
5
6
|
* @returns {number}
|
|
6
7
|
*/
|
|
7
8
|
export function binary_sort_rank(a, compare_1) {
|
package/all/bind_apply/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="../call/index.d.ts" />
|
|
2
2
|
/**
|
|
3
3
|
* Returns function bound to self that applies arg_a with ...arg_a_
|
|
4
4
|
* @param {call_fn_T}fn
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @param {unknown}[in_arg_a]
|
|
7
7
|
* @returns {(fn:call_fn_T, unknown, in_arg_a?:unknown[])=>ReturnType<call_fn_T>}
|
|
8
8
|
*/
|
|
9
|
-
export function bind_apply_(fn,
|
|
10
|
-
return (find, self, in_arg_a)=>fn.apply(self, [
|
|
9
|
+
export function bind_apply_(fn, _self, _in_arg_a) {
|
|
10
|
+
return (find, self, in_arg_a)=>fn.apply(self ?? _self, [
|
|
11
11
|
...in_arg_a,
|
|
12
|
-
...fn_arg_a
|
|
12
|
+
...(fn_arg_a ?? _in_arg_a)
|
|
13
13
|
])
|
|
14
14
|
}
|
|
15
15
|
export {
|
package/all/bind_call/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/// <reference types="../call/index.d.ts" />
|
|
1
2
|
import { bind_apply_ } from '../bind_apply/index.js'
|
|
2
|
-
/** @typedef {import('../call/index.d.ts').call_fn_T} */
|
|
3
3
|
/**
|
|
4
4
|
* Returns function returning map of calls to fn_a bound to self that applies arg_a with ...arg_a_
|
|
5
5
|
* @param {call_fn_T[]}fn_a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="../call/index.d.ts" />
|
|
2
2
|
/**
|
|
3
3
|
* Returns function bound to self that returns a map of fn_al calls with ...fac_arg_a concat with ...fn_arg_a passed
|
|
4
4
|
* to function
|
|
@@ -9,10 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export function bind_map_call_(fn_a, self, ...fac_arg_a) {
|
|
11
11
|
return (...fn_arg_a)=>fn_a.map((fn)=>fn.call(self, ...[
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
12
|
+
...fac_arg_a,
|
|
13
|
+
...fn_arg_a
|
|
14
|
+
]))
|
|
16
15
|
}
|
|
17
16
|
export {
|
|
18
17
|
bind_map_call_ as _bind_map_call,
|
package/all/btoa/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="../btoa/index.d.ts" />
|
|
1
2
|
/**
|
|
2
3
|
* @param {string}str
|
|
3
4
|
* @returns {string}
|
|
@@ -10,7 +11,7 @@ export function btoa(str) {
|
|
|
10
11
|
)
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
* @return {typeof
|
|
14
|
+
* @return {typeof btoa}
|
|
14
15
|
*/
|
|
15
16
|
export function btoa_() {
|
|
16
17
|
return btoa
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/// <reference types="../btoa_Uint32Array/index.d.ts" />
|
|
1
2
|
import { btoa_ } from '../btoa/index.js'
|
|
2
3
|
/**
|
|
3
4
|
* btoa helper functions
|
|
4
5
|
*/
|
|
5
|
-
/** @type {typeof
|
|
6
|
+
/** @type {typeof btoa_Uint32Array_} */
|
|
6
7
|
export const btoa_Uint32Array_ = b64=>{
|
|
7
8
|
const btoa = btoa_()
|
|
8
9
|
const $ = btoa(b64)
|