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.
Files changed (209) hide show
  1. package/all/CACHE_VERSION/index.d.ts +10 -0
  2. package/all/CACHE_VERSION/index.js +14 -0
  3. package/all/NODE_ENV/index.d.ts +10 -0
  4. package/all/NODE_ENV/index.js +14 -0
  5. package/all/Request/index.js +2 -1
  6. package/all/Response/index.js +1 -1
  7. package/all/VERSION/index.d.ts +7 -0
  8. package/all/VERSION/index.js +12 -0
  9. package/all/add/index.js +1 -1
  10. package/all/all_union_a/index.js +1 -1
  11. package/all/and/index.js +2 -1
  12. package/all/andand_or/index.js +2 -1
  13. package/all/andandfn/index.js +4 -3
  14. package/all/apply/index.js +4 -2
  15. package/all/arg_a__pick/index.d.ts +6 -0
  16. package/all/arg_a__pick/index.js +16 -0
  17. package/all/arg_i0_a/index.js +3 -2
  18. package/all/assign_fn_key_a/index.js +1 -1
  19. package/all/bad_gateway/index.js +2 -1
  20. package/all/bad_request/index.js +1 -1
  21. package/all/be/index.js +3 -2
  22. package/all/be_/index.d.ts +38 -3
  23. package/all/be_/index.js +52 -14
  24. package/all/be_/index.test.ts +191 -90
  25. package/all/be_lock_memosig_triple/index.test.ts +6 -6
  26. package/all/be_memo_pair/index.test.ts +4 -4
  27. package/all/be_memosig_triple/index.test.ts +6 -6
  28. package/all/be_sig_triple/index.test.ts +4 -4
  29. package/all/binary_sort_rank/index.js +2 -1
  30. package/all/bind_apply/index.js +4 -4
  31. package/all/bind_call/index.js +1 -1
  32. package/all/bind_map_apply/index.js +1 -1
  33. package/all/bind_map_call/index.js +4 -5
  34. package/all/btoa/index.js +2 -1
  35. package/all/btoa_Uint32Array/index.js +2 -1
  36. package/all/call/index.js +2 -1
  37. package/all/call_assign/index.js +2 -1
  38. package/all/chain/index.js +3 -2
  39. package/all/clone_assign_fn_key_a/index.js +2 -1
  40. package/all/color_hsv_phi_rgb_a/index.js +3 -2
  41. package/all/color_invert_rgb_a/index.js +3 -2
  42. package/all/compact_a_ctx/index.js +2 -1
  43. package/all/compare/index.js +2 -1
  44. package/all/compose/index.js +5 -5
  45. package/all/concat_truthy_a/index.js +4 -2
  46. package/all/console__error/index.js +2 -1
  47. package/all/crypto__sign/index.js +2 -1
  48. package/all/currency_str/index.js +2 -1
  49. package/all/currency_symbol/index.js +2 -1
  50. package/all/curry/index.js +2 -2
  51. package/all/date/index.js +1 -1
  52. package/all/default_arg_a/index.d.ts +11 -0
  53. package/all/default_arg_a/index.js +41 -0
  54. package/all/dfn_flag_r/index.d.ts +8 -0
  55. package/all/dfn_flag_r/index.js +24 -0
  56. package/all/difference_a/index.js +4 -2
  57. package/all/each/index.js +2 -1
  58. package/all/ensure__refresh/index.js +3 -2
  59. package/all/eq/index.js +5 -3
  60. package/all/eql_fn_a/index.js +1 -1
  61. package/all/error__print/index.js +4 -2
  62. package/all/error_o/index.js +4 -2
  63. package/all/falsy__none/index.js +2 -1
  64. package/all/fetch/index.js +2 -1
  65. package/all/fetch__template_pair/index.js +2 -1
  66. package/all/fetch_method/index.js +2 -1
  67. package/all/fetch_response_pair/index.js +4 -2
  68. package/all/filter/index.js +2 -1
  69. package/all/filter_o/index.js +3 -2
  70. package/all/find/index.js +1 -1
  71. package/all/flag_a/index.d.ts +6 -0
  72. package/all/flag_a/index.js +13 -0
  73. package/all/flag_r/index.d.ts +8 -0
  74. package/all/flag_r/index.js +34 -0
  75. package/all/flag_r__pick/index.d.ts +11 -0
  76. package/all/flag_r__pick/index.js +31 -0
  77. package/all/flag_r_arg_a/index.d.ts +9 -0
  78. package/all/flag_r_arg_a/index.js +27 -0
  79. package/all/flag_r_param_name/index.d.ts +9 -0
  80. package/all/flag_r_param_name/index.js +24 -0
  81. package/all/flag_regex/index.d.ts +1 -0
  82. package/all/flag_regex/index.js +1 -0
  83. package/all/flatten/index.js +7 -7
  84. package/all/flip/index.js +3 -2
  85. package/all/head_arg_a/index.js +3 -2
  86. package/all/headers/index.js +1 -1
  87. package/all/hex__digest/index.js +2 -1
  88. package/all/hmac/index.js +2 -1
  89. package/all/hmac_key/index.js +2 -1
  90. package/all/html/index.d.ts +0 -1
  91. package/all/html/index.js +0 -4
  92. package/all/html_attr/index.d.ts +0 -2
  93. package/all/html_attr/index.js +0 -2
  94. package/all/html_attrs/index.d.ts +0 -1
  95. package/all/html_attrs/index.js +0 -1
  96. package/all/html_class/index.d.ts +0 -2
  97. package/all/html_class/index.js +0 -2
  98. package/all/html_dataset__data_attrs/index.d.ts +0 -1
  99. package/all/html_dataset__data_attrs/index.js +0 -1
  100. package/all/html_style/index.d.ts +0 -2
  101. package/all/html_style/index.js +0 -2
  102. package/all/html_style__assign/index.d.ts +2 -6
  103. package/all/html_style__assign/index.js +0 -5
  104. package/all/html_styles_o/index.d.ts +0 -5
  105. package/all/html_styles_o/index.js +0 -5
  106. package/all/http_error/index.js +4 -2
  107. package/all/idx/index.js +2 -1
  108. package/all/idx_filter/index.js +2 -2
  109. package/all/idx_key_r/index.js +5 -4
  110. package/all/idx_reject/index.js +1 -1
  111. package/all/idx_sort_a__sort_idx_o/index.js +2 -1
  112. package/all/import_meta_env/index.d.ts +10 -0
  113. package/all/import_meta_env/index.js +18 -0
  114. package/all/index.d.ts +22 -0
  115. package/all/index.js +22 -0
  116. package/all/intersection_a/index.js +4 -2
  117. package/all/intersection_by/index.js +2 -1
  118. package/all/invalid_state/index.js +2 -2
  119. package/all/is_development/index.d.ts +6 -0
  120. package/all/is_development/index.js +9 -0
  121. package/all/is_production/index.d.ts +9 -0
  122. package/all/is_production/index.js +12 -0
  123. package/all/is_staging/index.d.ts +9 -0
  124. package/all/is_staging/index.js +12 -0
  125. package/all/item_r_idx/index.js +2 -1
  126. package/all/js_html/index.d.ts +0 -4
  127. package/all/js_html/index.js +0 -4
  128. package/all/left_and/index.js +2 -1
  129. package/all/left_or/index.js +2 -1
  130. package/all/line__parse/index.js +2 -3
  131. package/all/line__transform_stream/index.js +1 -1
  132. package/all/links_html/index.d.ts +0 -5
  133. package/all/links_html/index.js +0 -4
  134. package/all/many_andand/index.js +4 -2
  135. package/all/many_andand_or/index.js +6 -3
  136. package/all/map/index.js +1 -1
  137. package/all/map_andand/index.js +1 -1
  138. package/all/map_andand_or/index.js +3 -2
  139. package/all/map_andandfn/index.js +2 -1
  140. package/all/map_apply/index.js +2 -1
  141. package/all/map_call/index.js +3 -2
  142. package/all/map_find/index.js +1 -1
  143. package/all/map_obj/index.js +3 -2
  144. package/all/map_obj_andand/index.js +1 -1
  145. package/all/missing_argument/index.js +3 -2
  146. package/all/missing_env__throw/index.d.ts +8 -0
  147. package/all/missing_env__throw/index.js +19 -0
  148. package/all/money_str/index.js +2 -2
  149. package/all/neq/index.js +2 -1
  150. package/all/not/index.js +4 -3
  151. package/all/not_found/index.js +1 -1
  152. package/all/nullish__none/index.js +1 -1
  153. package/all/nullish__not_all/index.js +1 -1
  154. package/all/number__count/index.js +2 -2
  155. package/all/o_a_present/index.js +1 -1
  156. package/all/one_andand/index.js +2 -1
  157. package/all/one_andand_or/index.js +3 -2
  158. package/all/or/index.js +2 -3
  159. package/all/or_null/index.js +2 -1
  160. package/all/param_dfn/index.d.ts +1 -0
  161. package/all/param_dfn/index.js +1 -0
  162. package/all/param_dfn_a_reducer/index.d.ts +9 -0
  163. package/all/param_dfn_a_reducer/index.js +12 -0
  164. package/all/param_dfn_split_regex/index.d.ts +1 -0
  165. package/all/param_dfn_split_regex/index.js +1 -0
  166. package/all/param_name_r_param_val_a/index.d.ts +11 -0
  167. package/all/param_name_r_param_val_a/index.js +29 -0
  168. package/all/param_r/index.d.ts +16 -0
  169. package/all/param_r/index.js +33 -0
  170. package/all/param_r/index.test.ts +28 -0
  171. package/all/parseFloat_andor/index.d.ts +3 -2
  172. package/all/parseFloat_andor/index.test.ts +1 -1
  173. package/all/promise_o/index.js +2 -1
  174. package/all/rank/index.js +2 -1
  175. package/all/reduce/index.js +1 -1
  176. package/all/reject/index.js +1 -1
  177. package/all/response_o/index.js +2 -3
  178. package/all/right_and/index.js +2 -1
  179. package/all/right_or/index.js +2 -1
  180. package/all/rmemo/index.d.ts +1 -0
  181. package/all/slice_arg_a/index.js +3 -2
  182. package/all/slice_arg_spread_a/index.js +3 -2
  183. package/all/sort/index.js +1 -1
  184. package/all/sort_a/index.js +1 -1
  185. package/all/sort_idx_a/index.js +1 -1
  186. package/all/sort_idx_o/index.js +5 -4
  187. package/all/sort_val_a/index.js +1 -1
  188. package/all/sort_val_a__transition_idx_a/index.js +1 -3
  189. package/all/spread/index.js +1 -1
  190. package/all/spread_slice/index.js +2 -1
  191. package/all/tap/index.js +1 -1
  192. package/all/tempfile_path/index.test.ts +1 -1
  193. package/all/unauthorized/index.js +1 -1
  194. package/all/unformat_currency_str/index.js +1 -2
  195. package/all/union_a/index.js +3 -2
  196. package/all/union_by/index.js +1 -1
  197. package/all/url__join/index.js +2 -1
  198. package/all/weak_r/index.js +1 -1
  199. package/all/wrap_a/index.js +8 -5
  200. package/all/wrap_aa/index.js +3 -2
  201. package/all/wrap_concat/index.js +4 -3
  202. package/all/zip_with/index.js +1 -1
  203. package/cli-args/index.d.ts +14 -0
  204. package/cli-args/index.js +14 -0
  205. package/env/index.d.ts +8 -0
  206. package/env/index.js +8 -0
  207. package/html/index.d.ts +31 -0
  208. package/html/index.js +31 -0
  209. package/package.json +13 -7
@@ -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_|source_ctx__new', ()=>{
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 be0:Be<symbol> = be_(ctx=>be1(ctx))
174
- const be1:Be<symbol> = be_(ctx=>be0(ctx))
175
- const ctx = ctx__new()
176
- equal(be0(ctx), 'cir')
177
- equal(be1(ctx), 'cir')
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 source_ctx = ns_ctx__new(ctx1, ctx0)
183
- ctx__set(source_ctx, 'key', 2, 'ctx0')
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(source_ctx, 'key', 1)
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
- ctx__delete(ctx0, 'key')
227
+ const key_ = be_(()=>
228
+ true,
229
+ { id: 'key' })
230
+ ctx__delete(ctx0, key_)
197
231
  equal(ctx0.s[''].has('key'), false)
198
- ctx0.s[''].set('key', true)
199
- equal(ctx0.s[''].get('key'), true)
200
- ctx__delete(ctx0, 'key')
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 source_ctx = ns_ctx__new(ctx0, ctx1, 'test_source')
204
- ctx0.s[''].set('key', true)
205
- ctx1.s[''].set('key', true)
206
- equal(ctx0.s[''].get('key'), true)
207
- equal(ctx1.s[''].get('key'), true)
208
- ctx__delete(source_ctx, 'key')
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
- source_ctx.s['test_source'].set('key', true)
212
- equal(source_ctx.s['test_source'].get('key'), true)
213
- ctx__delete(source_ctx, 'key')
214
- equal(source_ctx.s['test_source'].get('key'), true)
215
- ctx__delete(source_ctx, 'key', 'test_source')
216
- equal(source_ctx.s['test_source'].has('key'), false)
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 is_source__num_ =
290
+ const ns__num_ =
254
291
  be_(()=>1,
255
292
  { ns: 'ctx1' })
256
- is_source__num_(ns_ctx)
293
+ ns__num_(ns_ctx)
257
294
  // @ts-expect-error TS2345
258
- equal(ctx0.s[''].has(is_source__num_.id), false)
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(is_source__num_.id), true)
262
- ctx__delete(ns_ctx, is_source__num_)
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(is_source__num_.id), false)
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(is_source__num_.id), false)
268
- is_source__num_(ns_ctx)
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(is_source__num_.id), false)
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(is_source__num_.id), true)
274
- ctx__delete(ns_ctx, is_source__num_)
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(is_source__num_.id), false)
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(is_source__num_.id), false)
280
- is_source__num_(ns_ctx)
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(is_source__num_.id), false)
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(is_source__num_.id), true)
286
- ctx__delete(ns_ctx, is_source__num_, '')
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(is_source__num_.id), false)
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(is_source__num_.id), true)
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.s[''].set('key', true)
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 source_ctx = ns_ctx__new(ctx0, ctx1, 'test_source')
303
- ctx1.s[''].set('key', true)
304
- equal(be__has_('key', source_ctx), false)
305
- equal(be__has_('key', source_ctx, 'test_source'), false)
306
- ctx0.s[''].set('key', true)
307
- equal(be__has_('key', source_ctx), true)
308
- equal(be__has_('key', source_ctx, 'test_source'), false)
309
- source_ctx.s.test_source.set('key', true)
310
- equal(be__has_('key', source_ctx, 'test_source'), true)
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.s[''].set('key', true)
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 source_ctx = ns_ctx__new(ctx0, ctx1, 'test_source')
324
- is.not(source_ctx.s.test_source, be_map0)
325
- is.not(source_ctx.s.test_source, be_map1)
326
- ctx1.s[''].set('key', true)
327
- equal(be_map__find('key', source_ctx), undefined)
328
- equal(be_map__find('key', source_ctx, 'test_source'), undefined)
329
- ctx0.s[''].set('key', true)
330
- equal(be_map__find('key', source_ctx), be_map0)
331
- equal(be_map__find('key', source_ctx, 'test_source'), undefined)
332
- source_ctx.s.test_source.set('key', true)
333
- equal(be_map__find('key', source_ctx, 'test_source'), source_ctx.s.test_source)
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 source_ctx = ns_ctx__new(ctx0, ctx1, 'test_source')
339
- const val_ = be_<boolean>(()=>
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_(source_ctx), true)
343
- equal(source_ctx.s[''].get(val_.id), true)
344
- equal(be__val_(val_, source_ctx), true)
345
- equal(be__val_('val_', source_ctx), true)
346
- ctx__set(source_ctx, val_, false)
347
- equal(val_(source_ctx), false)
348
- equal(be__val_(val_, source_ctx), false)
349
- equal(be__val_('val_', source_ctx), false)
350
- equal(be__val_(val_, source_ctx, 'test_source'), undefined)
351
- equal(be__val_('val_', source_ctx, 'test_source'), undefined)
352
- source_ctx.s.test_source.set('val_', true)
353
- equal(be__val_(val_, source_ctx, 'test_source'), true)
354
- equal(be__val_('val_', source_ctx, 'test_source'), true)
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 {import('../array_types/index.js').compare_1_T}compare_1
5
+ * @param {compare_1_T}compare_1
5
6
  * @returns {number}
6
7
  */
7
8
  export function binary_sort_rank(a, compare_1) {
@@ -1,4 +1,4 @@
1
- /** @typedef {import('../call/index.d.ts').call_fn_T} */
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, self, in_arg_a) {
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 {
@@ -1,4 +1,4 @@
1
- /** @typedef {import('../call_fn/index.js')} */
1
+ /// <reference types="../call_fn/index.d.ts" />
2
2
  /**
3
3
  * Returns function bound to self that calls ...in_arg_a concat with ...fn_arg_a passed to function
4
4
  * @param {call_fn_T}fn
@@ -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
- /** @typedef {import('../call/index.d.ts').call_fn_T} */
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
- ...fac_arg_a,
13
- ...fn_arg_a
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 import('../btoa').btoa}
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 import('../btoa_Uint32Array/index.d.ts').btoa_Uint32Array_} */
6
+ /** @type {typeof btoa_Uint32Array_} */
6
7
  export const btoa_Uint32Array_ = b64=>{
7
8
  const btoa = btoa_()
8
9
  const $ = btoa(b64)