ctx-core 4.19.0 → 5.0.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 (176) hide show
  1. package/all/a_in_idx_a_map/index.d.ts +1 -3
  2. package/all/a_item/index.d.ts +3 -9
  3. package/all/a_length/index.d.ts +4 -7
  4. package/all/a_nowrap/index.d.ts +2 -4
  5. package/all/a_present/index.d.ts +4 -7
  6. package/all/a_some/index.d.ts +1 -3
  7. package/all/and/index.d.ts +3 -9
  8. package/all/and_call/index.d.ts +4 -8
  9. package/all/andand/index.d.ts +4 -11
  10. package/all/andand_or/index.d.ts +6 -8
  11. package/all/andandfn/index.d.ts +3 -12
  12. package/all/apply/index.d.ts +2 -2
  13. package/all/arg_i0_a/index.d.ts +1 -1
  14. package/all/array_types/index.d.ts +21 -28
  15. package/all/assign_fn_key_a/index.d.ts +1 -3
  16. package/all/be/index.d.ts +5 -3
  17. package/all/be_/index.d.ts +69 -48
  18. package/all/be_/index.js +39 -76
  19. package/all/be_/index.test.ts +244 -121
  20. package/all/be_lock_memosig_triple/index.d.ts +16 -22
  21. package/all/be_lock_memosig_triple/index.test.ts +47 -36
  22. package/all/be_memo_pair/index.d.ts +14 -11
  23. package/all/be_memo_pair/index.js +1 -2
  24. package/all/be_memo_pair/index.test.ts +47 -31
  25. package/all/be_memosig_triple/index.d.ts +16 -22
  26. package/all/be_memosig_triple/index.test.ts +48 -34
  27. package/all/be_sig_triple/index.d.ts +16 -13
  28. package/all/be_sig_triple/index.js +2 -3
  29. package/all/be_sig_triple/index.test.ts +42 -29
  30. package/all/bind_apply/index.d.ts +3 -3
  31. package/all/bind_call/index.d.ts +10 -11
  32. package/all/bind_map_apply/index.d.ts +2 -2
  33. package/all/bind_map_call/index.d.ts +2 -2
  34. package/all/call/index.d.ts +3 -3
  35. package/all/call_assign/index.d.ts +2 -6
  36. package/all/call_fn_a/index.d.ts +4 -3
  37. package/all/call_or_fn/index.d.ts +1 -4
  38. package/all/chain/index.d.ts +4 -8
  39. package/all/chunk_aa/index.d.ts +3 -5
  40. package/all/clear_ctx/index.d.ts +1 -3
  41. package/all/combinators/index.d.ts +12 -49
  42. package/all/compact/index.d.ts +4 -7
  43. package/all/compact_a_ctx/index.d.ts +1 -3
  44. package/all/compare/index.d.ts +1 -3
  45. package/all/compose/index.d.ts +3 -3
  46. package/all/concat/index.d.ts +2 -6
  47. package/all/concat_truthy_a/index.d.ts +3 -4
  48. package/all/ctx/index.d.ts +18 -2
  49. package/all/ctx/index.js +20 -8
  50. package/all/ctx/index.test.ts +33 -7
  51. package/all/curry/index.d.ts +5 -7
  52. package/all/curry/index.js +6 -3
  53. package/all/debounce/index.d.ts +12 -12
  54. package/all/difference_a/index.d.ts +1 -3
  55. package/all/difference_by/index.d.ts +3 -4
  56. package/all/difference_set/index.d.ts +1 -5
  57. package/all/each/index.d.ts +5 -9
  58. package/all/ensure/index.d.ts +1 -3
  59. package/all/ensure__refresh/index.d.ts +1 -3
  60. package/all/eq/index.d.ts +4 -10
  61. package/all/eql/index.d.ts +3 -9
  62. package/all/eql_a/index.d.ts +1 -3
  63. package/all/eql_fn_a/index.d.ts +1 -3
  64. package/all/every/index.d.ts +3 -9
  65. package/all/exclude/index.d.ts +1 -4
  66. package/all/falsy_async_guard/index.d.ts +3 -4
  67. package/all/falsy_guard/index.d.ts +4 -3
  68. package/all/fetch__template_pair/index.test.ts +5 -5
  69. package/all/filter/index.d.ts +4 -12
  70. package/all/find/index.d.ts +6 -10
  71. package/all/first/index.d.ts +2 -7
  72. package/all/flatten/index.d.ts +2 -6
  73. package/all/flip/index.d.ts +3 -3
  74. package/all/hasOwnProperty_pick/index.d.ts +4 -4
  75. package/all/head_arg_a/index.d.ts +4 -3
  76. package/all/idx/index.d.ts +1 -3
  77. package/all/idx_reject/index.d.ts +3 -9
  78. package/all/idx_sort_a/index.d.ts +1 -3
  79. package/all/idx_sort_a__sort_idx_o/index.d.ts +1 -3
  80. package/all/idx_sort_r_a/index.d.ts +1 -3
  81. package/all/if_null_set_false/index.d.ts +1 -3
  82. package/all/ifelse/index.d.ts +5 -3
  83. package/all/iife/index.d.ts +3 -3
  84. package/all/index.d.ts +1 -0
  85. package/all/index.js +1 -0
  86. package/all/intersection_a/index.d.ts +5 -6
  87. package/all/intersection_by/index.d.ts +3 -4
  88. package/all/intersection_set/index.d.ts +1 -3
  89. package/all/isArray/index.d.ts +2 -2
  90. package/all/last/index.d.ts +2 -7
  91. package/all/left_and/index.d.ts +1 -3
  92. package/all/left_or/index.d.ts +1 -3
  93. package/all/many_andand/index.d.ts +7 -6
  94. package/all/many_andand_or/index.d.ts +2 -8
  95. package/all/map/index.d.ts +4 -18
  96. package/all/map_andand/index.d.ts +3 -9
  97. package/all/map_andand_or/index.d.ts +1 -3
  98. package/all/map_andandfn/index.d.ts +2 -6
  99. package/all/map_apply/index.d.ts +5 -8
  100. package/all/map_apply/index.js +1 -1
  101. package/all/map_call/index.d.ts +5 -8
  102. package/all/map_find/index.d.ts +3 -11
  103. package/all/map_fn/index.d.ts +1 -4
  104. package/all/map_obj/index.d.ts +3 -12
  105. package/all/map_obj_andand/index.d.ts +2 -8
  106. package/all/merge/index.d.ts +1 -4
  107. package/all/mixin/index.d.ts +1 -4
  108. package/all/neq/index.d.ts +2 -6
  109. package/all/neql/index.d.ts +2 -6
  110. package/all/noinit/index.d.ts +5 -8
  111. package/all/not/index.d.ts +3 -9
  112. package/all/notnot/index.d.ts +2 -4
  113. package/all/nullish__guard/index.d.ts +3 -4
  114. package/all/nullish__guard__async/index.d.ts +3 -4
  115. package/all/nullish__none/index.d.ts +1 -3
  116. package/all/o_a_present/index.d.ts +2 -6
  117. package/all/o_some/index.d.ts +1 -3
  118. package/all/offset_destructure_aa/index.d.ts +1 -3
  119. package/all/offset_i_slice/index.d.ts +2 -6
  120. package/all/one_andand/index.d.ts +3 -3
  121. package/all/one_andand_or/index.d.ts +3 -5
  122. package/all/or/index.d.ts +6 -17
  123. package/all/or_property/index.d.ts +1 -5
  124. package/all/promise_timeout/index.d.ts +4 -4
  125. package/all/prototype_mixin/index.d.ts +4 -3
  126. package/all/prototype_mixin/index.js +3 -3
  127. package/all/push/index.d.ts +2 -6
  128. package/all/r_val_a/index.d.ts +2 -6
  129. package/all/rank/index.d.ts +3 -4
  130. package/all/reduce/index.d.ts +10 -23
  131. package/all/reject/index.d.ts +7 -14
  132. package/all/remove/index.d.ts +2 -6
  133. package/all/remove_idx/index.d.ts +4 -4
  134. package/all/resolver_curry/index.d.ts +2 -2
  135. package/all/reverse/index.d.ts +2 -10
  136. package/all/right_and/index.d.ts +1 -3
  137. package/all/right_or/index.d.ts +1 -3
  138. package/all/rmemo/index.js +3 -3
  139. package/all/rmemo__wait/index.test.ts +1 -1
  140. package/all/run/index.d.ts +1 -4
  141. package/all/selector_splice/index.d.ts +1 -3
  142. package/all/slice/index.d.ts +5 -15
  143. package/all/slice_arg_a/index.d.ts +3 -12
  144. package/all/slice_arg_spread_a/index.d.ts +3 -11
  145. package/all/sort/index.d.ts +4 -14
  146. package/all/sort_a/index.d.ts +2 -6
  147. package/all/sort_idx_a/index.d.ts +2 -6
  148. package/all/sort_idx_o/index.d.ts +2 -6
  149. package/all/sort_val_a/index.d.ts +2 -6
  150. package/all/sort_val_a__transition_idx_a/index.d.ts +4 -12
  151. package/all/sort_val_a__transition_idx_a/index.js +4 -2
  152. package/all/sparse_a/index.d.ts +1 -3
  153. package/all/splice/index.d.ts +2 -6
  154. package/all/spread/index.d.ts +2 -6
  155. package/all/tap/index.d.ts +1 -3
  156. package/all/test/index.d.ts +12 -0
  157. package/all/test/index.js +1 -0
  158. package/all/throttle/index.d.ts +2 -2
  159. package/all/throttle/index.js +8 -7
  160. package/all/tick/index.d.ts +1 -5
  161. package/all/timeout_promise/index.d.ts +1 -5
  162. package/all/times/index.d.ts +1 -5
  163. package/all/tup/index.d.ts +22 -6
  164. package/all/union_a/index.d.ts +1 -3
  165. package/all/union_set/index.d.ts +1 -5
  166. package/all/val/index.d.ts +1 -3
  167. package/all/value_r/index.d.ts +2 -6
  168. package/all/weak_r/index.d.ts +3 -3
  169. package/all/wrap_a/index.d.ts +6 -14
  170. package/all/wrap_a_item/index.d.ts +5 -4
  171. package/all/wrap_aa/index.d.ts +3 -9
  172. package/all/wrap_aa_item/index.d.ts +5 -4
  173. package/all/wrap_concat/index.d.ts +1 -5
  174. package/package.json +33 -10
  175. package/test/index.d.ts +1 -0
  176. package/test/index.js +1 -0
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Returns Array of values from `a` with index in `idx_a`.
3
3
  */
4
- export declare function a_in_idx_a_map<
5
- Val extends unknown = unknown
6
- >(
4
+ export declare function a_in_idx_a_map<Val>(
7
5
  idx_a:readonly number[], a:readonly Val[]
8
6
  ):Val[]
9
7
  export {
@@ -1,12 +1,6 @@
1
- export declare type a_item_T<
2
- I extends unknown = unknown
3
- > =
1
+ export declare type a_item_T<I> =
4
2
  I extends readonly (infer O)[]
5
3
  ? O
6
4
  : I
7
- export declare type a1_item_type<
8
- I extends unknown = unknown
9
- > = a_item_T<I>
10
- export declare type a1_item_T<
11
- I extends unknown = unknown
12
- > = a_item_T<I>
5
+ export declare type a1_item_type<I> = a_item_T<I>
6
+ export declare type a1_item_T<I> = a_item_T<I>
@@ -1,13 +1,10 @@
1
1
  /**
2
2
  * Returns length of `in_a`
3
3
  */
4
- export declare function a_length_<
5
- Val extends unknown = unknown
6
- >(a:readonly Val[]):number
7
- export declare function maybe_a__length_<
8
- Val extends unknown = unknown, Or = null
9
- >(
10
- maybe_a:readonly Val[]|undefined, or?:Or
4
+ export declare function a_length_<Val>(a:readonly Val[]):number
5
+ export declare function maybe_a__length_<Val, Or = null>(
6
+ maybe_a:readonly Val[]|undefined,
7
+ or?:Or
11
8
  ):number|Or
12
9
  export {
13
10
  a_length_ as a_length_fn,
@@ -1,7 +1,5 @@
1
- export declare type a_nowrap_T<
2
- I extends unknown = unknown
3
- > =
1
+ export declare type a_nowrap_T<I> =
4
2
  I
5
3
  |readonly I[]
6
4
  |readonly I[][]
7
- export declare type ANowrapT = a_nowrap_T
5
+ export declare type ANowrapT<I> = a_nowrap_T<I>
@@ -2,13 +2,10 @@ import { a_length_ } from '../a_length/index.js'
2
2
  /**
3
3
  * Returns true if `a` has a length
4
4
  */
5
- export declare function a_present_<
6
- Val extends unknown = unknown
7
- >(a:readonly Val[]):boolean
8
- export declare function maybe_a_present_fn<
9
- Val extends unknown = unknown, Or = null
10
- >(
11
- maybe_a:readonly Val[]|undefined, or?:Or
5
+ export declare function a_present_<Val>(a:readonly Val[]):boolean
6
+ export declare function maybe_a_present_fn<Val, Or = null>(
7
+ maybe_a:readonly Val[]|undefined,
8
+ or?:Or
12
9
  ):boolean|Or
13
10
  export {
14
11
  a_present_ as a1_present_fn,
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Returns true if some `predicate(value)` is truthy
3
3
  */
4
- export declare function a_some<
5
- Val extends unknown = unknown, POut extends unknown = unknown
6
- >(
4
+ export declare function a_some<Val, POut>(
7
5
  a:readonly Val[],
8
6
  predicate:(val:Val, index:number, a:readonly Val[])=>POut
9
7
  ):boolean
@@ -3,17 +3,11 @@ import type { falsy } from '../falsy/index.js'
3
3
  /**
4
4
  * Returns the first falsy or last item.
5
5
  */
6
- export declare function and<
7
- I extends unknown = unknown,
8
- O extends unknown = I
9
- >(a_nowrap:a_nowrap_T<I>):O|falsy
6
+ export declare function and<I, O = I>(a_nowrap:a_nowrap_T<I>):O|falsy
10
7
  /**
11
8
  * Returns the first falsy or last item function call or value in `in_value_a` .
12
9
  */
13
- export declare function and_<
14
- I extends unknown = unknown,
15
- O extends unknown = I
16
- >(a_nowrap:I):O|falsy
10
+ export declare function and_<I, O = I>(a_nowrap:I):O|falsy
17
11
  export { and_ as and__fn }
18
12
  /**
19
13
  * Returns function that returns the first falsy or last item function call or value in `in_value_a` .
@@ -21,7 +15,7 @@ export { and_ as and__fn }
21
15
  export declare function and_2<
22
16
  A_outer extends unknown[] = unknown[],
23
17
  A_inner extends unknown[] = unknown[],
24
- O extends unknown = unknown
18
+ O = unknown
25
19
  >(in_value_a:A_inner):(fn_value_a:A_outer)=>O|falsy
26
20
  export {
27
21
  and_2 as _and_fn,
@@ -1,14 +1,10 @@
1
1
  /**
2
2
  * Returns a function than returns the called fn_a(value) chained with ands
3
3
  */
4
- export declare function and_call_<
5
- I extends unknown = unknown,
6
- O extends unknown = unknown
7
- >(fn_a:((in_value:I)=>O)[]):and_fn_call_T<I, O>;
8
- export declare type and_fn_call_T<
9
- I extends unknown = unknown,
10
- O extends unknown = unknown
11
- > = (in_value:I)=>O|null
4
+ export declare function and_call_<I, O>(
5
+ fn_a:((in_value:I)=>O)[]
6
+ ):and_fn_call_T<I, O>
7
+ export declare type and_fn_call_T<I, O> = (in_value:I)=>O|null
12
8
  export {
13
9
  and_call_ as and_fn_call_fn,
14
10
  and_call_ as _and_fn_call,
@@ -1,14 +1,7 @@
1
1
  /**
2
2
  * Applies `&&` to a chain of properties from `obj`.
3
3
  */
4
- export declare function andand<
5
- Val extends unknown = unknown,
6
- Out extends unknown = unknown
7
- >(obj:Val, ...name_a:andand_key_T<Val>[]):Out|null
8
- export declare type andand_key_T<
9
- Val extends unknown = unknown
10
- > = keyof Val|andand_key__T<Val>
11
- export declare type andand_key__T<
12
- Val extends unknown = unknown
13
- > = (val:Val)=>keyof Val
14
- export declare type andand_key_fn_T = andand_key__T
4
+ export declare function andand<Val, Out>(obj:Val, ...name_a:andand_key_T<Val>[]):Out|null
5
+ export declare type andand_key_T<Val> = keyof Val|andand_key__T<Val>
6
+ export declare type andand_key__T<Val> = (val:Val)=>keyof Val
7
+ export declare type andand_key_fn_T<Val> = andand_key__T<Val>
@@ -2,12 +2,10 @@ import type { andand_key_T } from '../andand/index.js'
2
2
  /**
3
3
  * Returns `andand(obj, name_a) || or_fn(obj, val)`
4
4
  */
5
- export declare function andand_or<
6
- Val extends unknown = unknown,
7
- Out extends unknown = unknown
8
- >(obj:Val, name_a:andand_key_T<Val>[], or_:andand_or_T<Val, Out>):Out
9
- export declare type andand_or_T<
10
- Val extends unknown = unknown,
11
- Out extends unknown = unknown
12
- > = (val:Out|null, obj:Val)=>Out
5
+ export declare function andand_or<Val, Out>(
6
+ obj:Val,
7
+ name_a:andand_key_T<Val>[],
8
+ or_:andand_or_T<Val, Out>
9
+ ):Out
10
+ export declare type andand_or_T<Val, Out> = (val:Out|null, obj:Val)=>Out
13
11
  export { andand_or as andand__or }
@@ -2,22 +2,13 @@ import type { andand_key_T } from '../andand/index.js'
2
2
  /**
3
3
  * Applies `&&` to a chain of property name or function with return value from `obj`.
4
4
  */
5
- export declare function andandfn<
6
- Val extends unknown = unknown,
7
- Out extends unknown = unknown
8
- >(obj:Val, ...name_a:andand_key_T<Val>[]):Out
9
- export declare type andandfn_T<
10
- Val extends unknown = unknown,
11
- Out extends unknown = unknown
12
- > = (obj:Val)=>Out
5
+ export declare function andandfn<Val, Out>(obj:Val, ...name_a:andand_key_T<Val>[]):Out
6
+ export declare type andandfn_T<Val, Out> = (obj:Val)=>Out
13
7
  export { andandfn as andand__fn, }
14
8
  /**
15
9
  * Returns a function that calls `andand_(obj, ...name_a)`
16
10
  */
17
- export declare function andandfn_<
18
- In extends unknown = unknown,
19
- Out extends unknown = unknown
20
- >(
11
+ export declare function andandfn_<In, Out>(
21
12
  ...name_a:andand_key_T<In>[]
22
13
  ):andandfn_T<In, Out>
23
14
  export {
@@ -5,9 +5,9 @@ import type { call_fn_T } from '../call/index.js'
5
5
  */
6
6
  export declare function apply_<
7
7
  A1 extends unknown[] = unknown[],
8
- O1 extends unknown = unknown,
8
+ O1 = unknown,
9
9
  A2 extends unknown[] = unknown[],
10
- O2 extends unknown = unknown
10
+ O2 = unknown
11
11
  >(
12
12
  fn:call_fn_T<A2, O2>, in_arg_a?:unknown[]
13
13
  ):bind_call_T<A1, O1>
@@ -4,7 +4,7 @@ import type { slice_arg_spread_a___ret_T, slice_arg_spread_a__arg__T } from '../
4
4
  */
5
5
  export declare function arg_i0_a<
6
6
  In extends unknown[] = unknown[],
7
- Out extends unknown = unknown
7
+ Out = unknown
8
8
  >(
9
9
  fn:slice_arg_spread_a__arg__T<In, Out>
10
10
  ):slice_arg_spread_a___ret_T<In, Out>
@@ -88,47 +88,40 @@ export interface sort_val_a__transition_a_frame_T<I> {
88
88
  export declare type sort_val_a$transition_a_frame_T<I> = sort_val_a__transition_a_frame_T<I>
89
89
  export declare type compact_a_ctx_I<I> = sort_val_a__transition_a_frame_T<I>
90
90
  export declare type compact_a1_ctx_I<I> = sort_val_a__transition_a_frame_T<I>
91
- export declare type compare_1_T<
92
- Val extends unknown = unknown
93
- > = (val:Val, idx?:number)=>number
94
- export declare type compare_T<
95
- I extends unknown = unknown
96
- > = (a:I, b:I)=>number
97
- export declare type is_match__T<
98
- Val extends unknown = unknown
99
- > = (in_value:Val, idx:number)=>boolean
100
- export declare type is_match_fn_T<Val extends unknown = unknown> = is_match__T<Val>
101
- export declare type _is_match_T<Val extends unknown = unknown> = is_match__T<Val>
102
- export declare type _is_match_type<Val extends unknown = unknown> = is_match__T<Val>
91
+ export declare type compare_1_T<Val> = (val:Val, idx?:number)=>number
92
+ export declare type compare_T<I> = (a:I, b:I)=>number
93
+ export declare type is_match__T<Val> = (in_value:Val, idx:number)=>boolean
94
+ export declare type is_match_fn_T<Val> = is_match__T<Val>
95
+ export declare type _is_match_T<Val> = is_match__T<Val>
96
+ export declare type _is_match_type<Val> = is_match__T<Val>
103
97
  export declare type item_key_idx_val_fn_T<
104
- Val extends unknown = unknown,
98
+ Val,
105
99
  Obj extends Record<string, Val> = Record<string, Val>
106
100
  > = (val:Val, item:Obj, key:string|number, idx:number)=>string
107
101
  export declare type _item_key_idx_val_T<
108
- Val extends unknown = unknown,
102
+ Val,
109
103
  Obj extends Record<string, Val> = Record<string, Val>
110
104
  > = item_key_idx_val_fn_T<Val, Obj>
111
105
  export declare type _item_key_idx_val_type<
112
- Val extends unknown = unknown,
106
+ Val,
113
107
  Obj extends Record<string, Val> = Record<string, Val>
114
108
  > = item_key_idx_val_fn_T<Val, Obj>
115
- export declare type sort_idx_ctx__T<I extends unknown = unknown> = (
109
+ export declare type sort_idx_ctx__T<I> = (
116
110
  a:readonly I[])=>sort_idx_o_T<I>
117
- export declare type sort_idx_ctx_2_T<I extends unknown = unknown> = sort_idx_ctx__T<I>
118
- export declare type sort_idx_ctx_a1_fn_type<I extends unknown = unknown> = sort_idx_ctx__T<I>
119
- export declare type fn__a1__ctx__idx__sort<I extends unknown = unknown> = sort_idx_ctx__T<I>
120
- export interface sort_idx_o_T<I extends unknown = unknown> {
111
+ export declare type sort_idx_ctx_2_T<I> = sort_idx_ctx__T<I>
112
+ export declare type sort_idx_ctx_a1_fn_type<I> = sort_idx_ctx__T<I>
113
+ export declare type fn__a1__ctx__idx__sort<I> = sort_idx_ctx__T<I>
114
+ export interface sort_idx_o_T<I> {
121
115
  sort_idx_a:readonly number[]
122
116
  sort_val_a:I[]
123
117
  }
124
- export declare type sort_idx_ctx_T<I extends unknown = unknown> = sort_idx_o_T<I>
125
- export declare type ctx__idx__sort<I extends unknown = unknown> = sort_idx_o_T<I>
126
- export declare type sort_val_a__transition_a_frame_fn_T<
127
- I extends unknown = unknown
128
- > = (in_val_a:readonly I[]|undefined)=>sort_val_a__transition_a_frame_T<I>
129
- export declare type sort_val_a$transition_a_frame_fn_T<I extends unknown = unknown> =
118
+ export declare type sort_idx_ctx_T<I> = sort_idx_o_T<I>
119
+ export declare type ctx__idx__sort<I> = sort_idx_o_T<I>
120
+ export declare type sort_val_a__transition_a_frame_fn_T<I> =
121
+ (in_val_a:readonly I[]|undefined)=>sort_val_a__transition_a_frame_T<I>
122
+ export declare type sort_val_a$transition_a_frame_fn_T<I> =
130
123
  sort_val_a__transition_a_frame_T<I>
131
- export declare type thold_a_compact_ctx__T<I extends unknown = unknown> =
124
+ export declare type thold_a_compact_ctx__T<I> =
132
125
  sort_val_a__transition_a_frame_fn_T<I>
133
- export declare type thold_a1_compact_ctx_fn_type<I extends unknown = unknown> =
126
+ export declare type thold_a1_compact_ctx_fn_type<I> =
134
127
  sort_val_a__transition_a_frame_fn_T<I>
@@ -2,9 +2,7 @@ import type { assign_fn_T } from '../call_assign/index.js'
2
2
  /**
3
3
  * Assigns to obj array of keys the return value of function in key_a_fn_aa.
4
4
  */
5
- export declare function assign_fn_key_a<
6
- I extends unknown = unknown
7
- >(
5
+ export declare function assign_fn_key_a<I>(
8
6
  obj:Record<string, I>,
9
7
  ...key_a_fn_aa:fn_key_a_tuple_T<I>[]
10
8
  ):Record<string, I>
package/all/be/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import type { be__val__new_T, Ctx } from '../be_/index.js'
1
+ import type { be__val__new_T, Ctx, Ctx_wide_T } from '../be_/index.js'
2
2
  export declare function be<
3
- Out extends NonNullable<unknown>
4
- >(ctx:Ctx, val_:be__val__new_T<Out>):Out
3
+ Out extends NonNullable<unknown>,
4
+ ns_T extends string = '',
5
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>
6
+ >(ctx:ctx_T, val_:be__val__new_T<Out, ns_T, ctx_T>):Out
5
7
  export { be as b, }
@@ -1,8 +1,10 @@
1
- export declare const pending_symbol:unique symbol
2
1
  export declare function globalThis__be_<
3
2
  val_T,
4
- ctx_T extends Ctx = Ctx
5
- >(val__new:be__val__new_T<val_T, ctx_T>, config:be_config_T&{ id: string }):Be<val_T, ctx_T>
3
+ ns_T extends string = '',
4
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>
5
+ >(val__new:be__val__new_T<val_T, ns_T, ctx_T>, config:be_config_T<ns_T>&{
6
+ id:string
7
+ }):Be<val_T, ns_T, ctx_T>
6
8
  /**
7
9
  * Auto-memoization function for the Ctx.
8
10
  *
@@ -11,69 +13,88 @@ export declare function globalThis__be_<
11
13
  */
12
14
  export declare function be_<
13
15
  val_T,
14
- ctx_T extends Ctx = Ctx
15
- >(val__new:be__val__new_T<val_T, ctx_T>, config?:be_config_T):Be<val_T, ctx_T>
16
- export type be___T<
17
- val_T,
18
- ctx_T extends Ctx = Ctx
19
- > = typeof be_<val_T, ctx_T>
20
- export declare function be__is_source_<
21
- ctx_T extends Ctx = Ctx
22
- >(be:Be<unknown>):(map_ctx:MapCtx, ctx:ctx_T)=>boolean
23
- export declare function source__map_ctx_<
24
- ctx_T extends Ctx = Ctx
25
- >(ctx:ctx_T, is_source_:is_source__T):MapCtx
16
+ ns_T extends string = '',
17
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
18
+ >(
19
+ val__new:be__val__new_T<val_T, ns_T, ctx_T>,
20
+ config?:be_config_T<ns_T>
21
+ ):Be<val_T, ns_T, ctx_T>
26
22
  export declare function ctx__set<
27
23
  val_T,
28
- ctx_T extends Ctx = Ctx
24
+ ns_T extends string = '',
25
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>
29
26
  >(
30
27
  ctx:ctx_T,
31
28
  be_OR_id:Be<val_T>|string|symbol,
32
29
  val:val_T,
33
- is_source_?:is_source__T
30
+ ns?:ns_T
34
31
  ):void
35
32
  export declare function ctx__delete<
36
- val_T,
37
- ctx_T extends Ctx = Ctx
33
+ ns_T extends string = '',
34
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
38
35
  >(
39
36
  ctx:ctx_T,
40
- be_OR_id:Be<val_T>|string|symbol,
41
- is_source_?:is_source__T
37
+ be_OR_id:Be<unknown, ns_T, ctx_T>|string|symbol,
38
+ ns?:string
42
39
  ):void
43
40
  export declare function be__has_<
44
- ctx_T extends Ctx = Ctx
45
- >(be_OR_id:Be<unknown>|string, ctx:ctx_T):boolean
46
- export declare function be__ctx_<
47
- ctx_T extends Ctx = Ctx
48
- >(be_OR_id:Be<unknown>|string, ctx:ctx_T):MapCtx
41
+ ns_T extends string = '',
42
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
43
+ >(be_OR_id:Be<unknown, ns_T, ctx_T>|string, ctx:ctx_T, ns?:ns_T):boolean
44
+ export declare function be_map__find<
45
+ ns_T extends string = '',
46
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
47
+ >(be_OR_id:Be<unknown, ns_T, ctx_T>|string, ctx:ctx_T, ns?:ns_T):BeMap<ns_T>
49
48
  export declare function be__val_<
50
49
  val_T,
51
- ctx_T extends Ctx = Ctx
52
- >(be_OR_id:Be<val_T>|string, ctx:ctx_T):val_T|unknown|null
53
- export type MapCtx = Map<Be<unknown>|string|symbol, unknown>&{ is_ctx: true }
54
- export type NestedMapCtx = Array<NestedMapCtx|MapCtx>
55
- export type Ctx = MapCtx|NestedMapCtx
50
+ ns_T extends string = '',
51
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
52
+ >(be_OR_id:Be<val_T, ns_T, ctx_T>|string, ctx:ctx_T, ns?:ns_T):val_T|unknown|null
56
53
  export declare type Be<
57
54
  val_T,
58
- ctx_T extends Ctx = Ctx
59
- > = ((ctx:ctx_T)=>val_T)&{
60
- is_be: true
61
- id:string|Be<val_T, ctx_T>
55
+ ns_T extends string = '',
56
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
57
+ > = ((ctx:ctx_T)=>val_T)&be_o_T<val_T, ns_T, ctx_T>
58
+ export type be_o_T<
59
+ val_T,
60
+ ns_T extends string = '',
61
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>,
62
+ > = {
63
+ id:string|Be<val_T, ns_T, ctx_T>
64
+ ns:ns_T
65
+ is_be:true
62
66
  }
63
- export type be_config_T = {
67
+ export type be_config_T<ns_T extends string = string> = {
64
68
  id?:string
65
- is_source_?:is_source__T
69
+ ns?:ns_T
66
70
  }
67
- export declare type be__return_T<
68
- val_T,
69
- ctx_T extends Ctx = Ctx
70
- > = Be<val_T, ctx_T>
71
- export declare type be_T<
72
- val_T,
73
- ctx_T extends Ctx = Ctx
74
- > = Be<val_T, ctx_T>
71
+ export type BeMap<
72
+ ns_T extends string = ''
73
+ > = Map<Be<unknown, ns_T, Ctx_wide_T<ns_T>>|string|symbol, unknown>
74
+ export type BeMapO<ns_union_T extends string> =
75
+ { [K in ns_union_T]:BeMap<K> }
75
76
  export declare type be__val__new_T<
76
77
  val_T,
77
- ctx_T extends Ctx = Ctx
78
- > = (ctx:ctx_T, be:Be<val_T, ctx_T>)=>val_T
79
- export type is_source__T = (map_ctx:MapCtx, ctx:Ctx)=>boolean
78
+ ns_T extends string = '',
79
+ ctx_T extends Ctx = Ctx_wide_T<ns_T>
80
+ > = (ctx:ctx_T, be:Be<val_T, ns_T, ctx_T>)=>val_T
81
+ export type Ctx<ns_T extends string = string> = Readonly<{
82
+ s:Ctx_s_T<ns_T>
83
+ is_ctx:true
84
+ /**
85
+ * Used for type inference narrowing. There is no js implementation.
86
+ */
87
+ ns_T?:ns_T
88
+ }>
89
+ export type Ctx_wide_T<ns_union_T extends string> =
90
+ Ctx&Ctx_s_wide_T<ns_union_T>
91
+ export type Ctx_s_T<ns_union_T extends string = string> = {
92
+ [K in ns_union_T]:BeMap<K>
93
+ }
94
+ export type Ctx_s_wide_T<ns_union_T extends string> = {
95
+ s:BeMapO<ns_union_T>
96
+ }
97
+ export type ctx__be_T<ctx_T extends Ctx, be_val_T, ns_T extends string> =
98
+ Be<be_val_T, ns_T, ctx_T>
99
+ export type ctx__get_T<ctx_T extends Ctx, val_T> = (ctx:ctx_T)=>val_T
100
+ export type ctx__set_T<ctx_T extends Ctx, val_T> = (ctx:ctx_T, val:val_T)=>void
package/all/be_/index.js CHANGED
@@ -1,10 +1,5 @@
1
- /** @typedef {import('./index.d.ts').Be} */
2
- /** @typedef {import('./index.d.ts').be_} */
3
- /** @typedef {import('./index.d.ts').be_config_T} */
4
- /** @typedef {import('./index.d.ts').Ctx} */
5
- /** @typedef {import('./index.d.ts').MapCtx} */
6
- /** @typedef {import('./index.d.ts').be__val__new_T} */
7
- /** @typedef {import('./index.d.ts').is_source__T} */
1
+ /// <reference types="./index.d.ts" />
2
+ let _undefined
8
3
  /**
9
4
  * Auto-memoization function for the Ctx.
10
5
  *
@@ -16,27 +11,22 @@
16
11
  * @private
17
12
  */
18
13
  export function be_(val__new, config) {
19
- let be = argv__ctx=>{
20
- let flat__argv__ctx = argv__ctx.flat && argv__ctx.flat(Infinity)
21
- let be__ctx =
22
- flat__argv__ctx
23
- ? flat__argv__ctx.find(ctx=>ctx.has(be.id))
24
- : argv__ctx.has(be.id) && argv__ctx
25
- if (!be__ctx) {
26
- be__ctx =
27
- flat__argv__ctx
28
- ? flat__argv__ctx.find(ctx=>!be.is_source_ || be.is_source_(ctx, argv__ctx))
29
- : (!be.is_source_ || be.is_source_(argv__ctx, argv__ctx)) && argv__ctx
30
- // circular dependency state
31
- // if val__new calls this be before returning, 'cir' will be the value of this be
32
- // 'cir' is used instead of 'circular' to reduce the payload by a few bytes
33
- be__ctx.set(be.id, 'cir')
34
- be__ctx.set(be.id, val__new(argv__ctx, be))
35
- }
36
- return be__ctx.get(be.id)
14
+ let be = ctx=>{
15
+ let be_map = ctx.s[be.ns]
16
+ /* @if DEBUG **
17
+ // ~ 30 B
18
+ if (!be_map) throw Error('ctx_no_ns: \'' + be.ns + '\'')
19
+ /* @endif */
20
+ if (be_map.has(be.id)) return be_map.get(be.id)
21
+ // circular dependency state
22
+ // if val__new calls this be before returning, 'cir' will be the value of this be
23
+ // 'cir' is used instead of 'circular' to reduce the payload by a few bytes
24
+ be_map.set(be.id, 'cir')
25
+ be_map.set(be.id, val__new(ctx, be))
26
+ return be_map.get(be.id)
37
27
  }
38
28
  be.id = config?.id ?? be
39
- be.is_source_ = config?.is_source_
29
+ be.ns = config?.ns ?? ''
40
30
  be.is_be = true
41
31
  return be
42
32
  }
@@ -57,7 +47,7 @@ export { be_ as globalThis__be_ }
57
47
  * @param {Ctx}ctx
58
48
  * @param {Be|string|symbol}be_OR_id
59
49
  * @param {unknown}val
60
- * @param {is_source__T}[is_source_]
50
+ * @param {string}[ns]
61
51
  * @returns {unknown}
62
52
  * @private
63
53
  */
@@ -65,80 +55,53 @@ export function ctx__set(
65
55
  ctx,
66
56
  be_OR_id,
67
57
  val,
68
- is_source_ = be_OR_id.is_source_
58
+ ns = be_OR_id.ns ?? ''
69
59
  ) {
70
- let source__map_ctx = source__map_ctx_(ctx, is_source_)
71
- if (source__map_ctx) {
72
- source__map_ctx.set(be_OR_id.id ?? be_OR_id, val)
73
- }
60
+ ctx.s[ns].set(be_OR_id.id ?? be_OR_id, val)
74
61
  }
75
62
  /**
76
63
  * @param {Ctx}ctx
77
64
  * @param {Be|string|symbol}be_OR_id
65
+ * @param {string}[ns]
78
66
  */
79
67
  export function ctx__delete(
80
68
  ctx,
81
69
  be_OR_id,
70
+ ns = be_OR_id.ns ?? ''
82
71
  ) {
83
- if (Array.isArray(ctx)) {
84
- for (let _ctx of ctx) {
85
- ctx__delete(_ctx, be_OR_id)
86
- }
72
+ if (ns != null) {
73
+ ctx.s[ns].delete(be_OR_id.id ?? be_OR_id)
87
74
  } else {
88
- ctx.delete(be_OR_id.id ?? be_OR_id)
75
+ for (let _source in ctx.s) {
76
+ ctx.s[_source].delete(be_OR_id.id ?? be_OR_id)
77
+ }
89
78
  }
90
79
  }
91
80
  /**
92
- * @param {Be|string}be_or_id
93
- * @param {Ctx}argv__ctx
81
+ * @param {[Be|string, Ctx]|[Be|string, Ctx, string]}arg_a
94
82
  * @returns {boolean}
95
83
  * @private
96
84
  */
97
- export function be__has_(be_or_id, argv__ctx) {
98
- return Boolean(be__ctx_(be_or_id, argv__ctx))
85
+ export function be__has_(...arg_a) {
86
+ return Boolean(be_map__find(...arg_a))
99
87
  }
100
88
  /**
101
- * @param {Be|string}be_or_id
102
- * @param {Ctx}argv__ctx
103
- * @returns {MapCtx}
89
+ * @param {Be}be_or_id
90
+ * @param {Ctx}ctx
91
+ * @param {string}[ns]
92
+ * @returns {Ctx}
104
93
  * @private
105
94
  */
106
- export function be__ctx_(be_or_id, argv__ctx) {
107
- if (Array.isArray(argv__ctx)) {
108
- for (let ctx of argv__ctx) {
109
- let be__ctx = be__ctx_(be_or_id.id ?? be_or_id, ctx)
110
- if (be__ctx) return be__ctx
111
- }
112
- } else {
113
- if (argv__ctx.has(be_or_id.id ?? be_or_id)) return argv__ctx
114
- }
95
+ export function be_map__find(be_or_id, ctx, ns = be_or_id.ns ?? '') {
96
+ return ctx.s[ns].has(be_or_id.id ?? be_or_id) ? ctx.s[ns] : _undefined
115
97
  }
116
- export { be__ctx_ as be__has__ctx_ }
117
98
  /**
118
99
  * @param {Be|string}be_or_id
119
- * @param {Ctx}argv__ctx
120
- * @returns {unknown}
121
- * @private
122
- */
123
- export function be__val_(be_or_id, argv__ctx) {
124
- let be__ctx = be__ctx_(be_or_id, argv__ctx)
125
- if (be__ctx) return be__ctx.get(be_or_id.id ?? be_or_id)
126
- }
127
- /**
128
- * @param {Ctx}argv__ctx
129
- * @param {is_source__T}is_source_
100
+ * @param {Ctx}ctx
101
+ * @param {string}[ns]
130
102
  * @returns {unknown}
131
103
  * @private
132
104
  */
133
- export function source__map_ctx_(argv__ctx, is_source_) {
134
- if (Array.isArray(argv__ctx)) {
135
- for (let ctx of argv__ctx) {
136
- let source__map_ctx = source__map_ctx_(ctx, is_source_)
137
- if (source__map_ctx) return source__map_ctx
138
- }
139
- } else {
140
- if (!is_source_ || is_source_(argv__ctx, argv__ctx)) {
141
- return argv__ctx
142
- }
143
- }
105
+ export function be__val_(be_or_id, ctx, ns) {
106
+ return be_map__find(be_or_id, ctx, ns)?.get?.(be_or_id.id ?? be_or_id)
144
107
  }