ctx-core 3.3.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +3 -0
  2. package/all/all_union_a/index.js +1 -1
  3. package/all/andand_or/index.js +1 -1
  4. package/all/andandfn/index.js +2 -2
  5. package/all/arg_i0_a/index.js +1 -1
  6. package/all/bad_credentials/index.js +1 -1
  7. package/all/be/index.d.ts +2 -2
  8. package/all/be/index.js +3 -4
  9. package/all/be_/index.d.ts +34 -78
  10. package/all/be_/index.js +53 -136
  11. package/all/be_/index.test.ts +29 -63
  12. package/all/be_rmemo_pair/index.d.ts +23 -0
  13. package/all/be_rmemo_pair/index.js +36 -0
  14. package/all/be_rmemo_pair/index.test.ts +103 -0
  15. package/all/be_rsig_triple/index.d.ts +24 -0
  16. package/all/be_rsig_triple/index.js +36 -0
  17. package/all/be_rsig_triple/index.test.ts +78 -0
  18. package/all/call_assign/index.js +1 -1
  19. package/all/compose/index.js +1 -1
  20. package/all/ctx/index.js +7 -8
  21. package/all/ctx/index.test.ts +1 -0
  22. package/all/each/index.js +1 -1
  23. package/all/eql_fn_a/index.js +1 -1
  24. package/all/fetch__template_pair/index.js +1 -1
  25. package/all/filter/index.js +1 -1
  26. package/all/http_error/index.js +1 -1
  27. package/all/idx_filter/index.js +2 -2
  28. package/all/idx_key_r/index.js +4 -4
  29. package/all/index.d.ts +3 -5
  30. package/all/index.js +3 -5
  31. package/all/invalid_argument/index.js +1 -1
  32. package/all/invalid_state/index.js +1 -1
  33. package/all/map/index.js +1 -1
  34. package/all/missing_argument/index.js +1 -1
  35. package/all/o_a_present/index.js +1 -1
  36. package/all/or/index.js +2 -2
  37. package/all/reduce/index.js +1 -1
  38. package/all/reject/index.js +1 -1
  39. package/all/response_o/index.js +1 -1
  40. package/all/rmemo/index.d.ts +8 -2
  41. package/all/rmemo/index.js +27 -29
  42. package/all/sort/index.js +1 -1
  43. package/all/sort_idx_a/index.js +1 -1
  44. package/all/sort_val_a/index.js +1 -1
  45. package/all/sort_val_a__transition_idx_a/index.js +3 -3
  46. package/all/union_by/index.js +1 -1
  47. package/all/weak_r/index.js +1 -1
  48. package/all/zip_with/index.js +1 -1
  49. package/be/index.d.ts +0 -2
  50. package/be/index.js +0 -2
  51. package/object/index.d.ts +0 -4
  52. package/object/index.js +0 -4
  53. package/package.json +28 -7
  54. package/rmemo/index.d.ts +2 -0
  55. package/rmemo/index.js +2 -0
  56. package/all/be_/debug.js +0 -25
  57. package/all/be_arg_triple/index.d.ts +0 -21
  58. package/all/be_arg_triple/index.js +0 -41
  59. package/all/be_prop_pair/index.d.ts +0 -36
  60. package/all/be_prop_pair/index.js +0 -54
  61. package/all/be_prop_pair/index.test.ts +0 -137
  62. package/all/rc_be/index.d.ts +0 -9
  63. package/all/rc_be/index.js +0 -17
  64. package/all/rc_be_/index.d.ts +0 -42
  65. package/all/rc_be_/index.js +0 -62
  66. package/be/index.test.ts +0 -251
package/README.md CHANGED
@@ -1,2 +1,5 @@
1
1
  # ctx-core
2
2
  ctx-core core (ctx-core^2) libraries...used by @ctx-core/* libraries. The development monorepo has been moved to @ctx-core/dev
3
+
4
+ ## macropackage
5
+
@@ -1,4 +1,4 @@
1
- /** @typedef {import('../add/index.js').all_union_a_T}all_union_a_T */
1
+ /** @typedef {import('../add/index.js').all_union_a_T} */
2
2
  /**
3
3
  * @return {(a:all_union_a_T)=>all_union_a_T}
4
4
  * @see {@link https://stackoverflow.com/questions/60131681/make-sure-array-has-all-types-from-a-union/75418615#75418615}
@@ -1,5 +1,5 @@
1
1
  import { andand } from '../andand/index.js'
2
- /** @typedef {import('../andand/index.js').andand_key_T}andand_key_T */
2
+ /** @typedef {import('../andand/index.js').andand_key_T} */
3
3
  /**
4
4
  * Returns `andand(obj, name_a) || or_fn(obj, val)`
5
5
  * @param {unknown|null}obj
@@ -1,4 +1,4 @@
1
- /** @typedef {import('../andand/index.js').andand_key_T}andand_key_T */
1
+ /** @typedef {import('../andand/index.js').andand_key_T} */
2
2
  /**
3
3
  * Applies `&&` to a chain of property name or function with return value from `obj`.
4
4
  * @param {unknown}obj
@@ -24,7 +24,7 @@ export function andandfn(obj, ...name_a) {
24
24
  return out_value
25
25
  }
26
26
  export { andandfn as andand__fn, }
27
- /** @typedef {import('../andand/index.d.ts').andand_key_T}andand_key_T */
27
+ /** @typedef {import('../andand/index.d.ts').andand_key_T} */
28
28
  /**
29
29
  * Returns a function that calls `andand_(obj, ...name_a)`
30
30
  * @param {andand_key_T}name_a
@@ -1,5 +1,5 @@
1
1
  import { slice_arg_spread_a_ } from '../slice_arg_spread_a/index.js'
2
- /** @typedef {import('../slice_arg_spread_a_/index.js').slice_arg_spread_a__arg__T}slice_arg_spread_a__arg__T */
2
+ /** @typedef {import('../slice_arg_spread_a_/index.js').slice_arg_spread_a__arg__T} */
3
3
  /**
4
4
  * Returns a function that calls fn passing only the first argument.
5
5
  * @param {slice_arg_spread_a__arg__T}fn
@@ -1,6 +1,6 @@
1
1
  import { assign } from '../assign/index.js'
2
2
  import { HttpError } from '../http_error/index.js'
3
- /** @typedef {import('./index.d.ts').argument__bad_credentials_error_o_T}argument__bad_credentials_error_o_T */
3
+ /** @typedef {import('./index.d.ts').argument__bad_credentials_error_o_T} */
4
4
  export const bad_credentials__default__message = 'Unauthorized'
5
5
  /**
6
6
  * @param {string}[message]
package/all/be/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { be__val__T, Ctx } from '../be_/index.js'
1
+ import type { be__val__new_T, Ctx } from '../be_/index.js'
2
2
  export declare function be<
3
3
  Out extends NonNullable<unknown>
4
- >(ctx:Ctx, key:string, val_:be__val__T<Out>):Out
4
+ >(ctx:Ctx, val_:be__val__new_T<Out>):Out
5
5
  export { be as b, }
package/all/be/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { be_ } from '../be_/index.js'
2
2
  /**
3
3
  * @param {import('../be_/index.js').Ctx}ctx
4
- * @param {string}key
5
- * @param {import('../be_/index.js').be__val__T}val_
4
+ * @param {import('../be_/index.js').be__val__new_T}val_
6
5
  * @returns {NonNullable<unknown>}
7
6
  */
8
- export function be(ctx, key, val_) {
9
- return be_(key, val_)(ctx)
7
+ export function be(ctx, val_) {
8
+ return be_(val_)(ctx)
10
9
  }
11
10
  export { be as b, }
@@ -1,124 +1,80 @@
1
1
  export declare const pending_symbol:unique symbol
2
2
  export declare function globalThis__be_<
3
- Val,
3
+ val_T,
4
4
  ctx_T extends Ctx = Ctx
5
- >(
6
- val_:be__val__T<Val, ctx_T>,
7
- be__params?:be__params_T
8
- ):Be<Val, ctx_T>
9
- export declare function globalThis__be_<
10
- Val,
11
- ctx_T extends Ctx = Ctx
12
- >(
13
- id:string,
14
- val_:be__val__T<Val, ctx_T>,
15
- be__params?:be__params_T
16
- ):Be<Val, ctx_T>
5
+ >(val_:be__val__new_T<val_T, ctx_T>):Be<val_T, ctx_T>
17
6
  /**
18
7
  * Auto-memoization function for the Ctx.
19
8
  *
20
- * Returns a function to ensure that a member id is defined on a ctx object,
21
- * otherwise it creates the value using the val_ factory function.
9
+ * Returns a function to ensure that a member id is defined on a Ctx,
10
+ * otherwise it caches & uses the return value of val__new.
22
11
  */
23
12
  export declare function be_<
24
- Val,
13
+ val_T,
25
14
  ctx_T extends Ctx = Ctx
26
- >(
27
- val_:be__val__T<Val, ctx_T>,
28
- be__params?:be__params_T
29
- ):Be<Val, ctx_T>
30
- export declare function be_<
31
- Val,
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,
32
18
  ctx_T extends Ctx = Ctx
33
- >(
34
- id:string,
35
- val_:be__val__T<Val, ctx_T>,
36
- be__params?:be__params_T
37
- ):Be<Val, ctx_T>
38
- export {
39
- be_ as _be,
40
- be_ as b_,
41
- be_ as _b,
42
- }
19
+ > = typeof be_<val_T, ctx_T>
43
20
  export declare function be__is_source_<
44
21
  ctx_T extends Ctx = Ctx
45
22
  >(be:Be<unknown>):(map_ctx:MapCtx, ctx:ctx_T)=>boolean
46
23
  export declare function source__map_ctx_<
47
24
  ctx_T extends Ctx = Ctx
48
- >(ctx:Ctx, is_source_:is_source__T):MapCtx
49
- export declare function be__set<
50
- Val,
51
- ctx_T extends Ctx = Ctx
52
- >(
53
- be:Be<Val>,
54
- ctx:ctx_T,
55
- val:Val
56
- ):void
25
+ >(ctx:ctx_T, is_source_:is_source__T):MapCtx
57
26
  export declare function ctx__set<
58
- Val,
27
+ val_T,
59
28
  ctx_T extends Ctx = Ctx
60
29
  >(
61
30
  ctx:ctx_T,
62
- be_OR_id:Be<Val>|string|symbol,
63
- val:Val,
31
+ be_OR_id:Be<val_T>|string|symbol,
32
+ val:val_T,
64
33
  is_source_?:is_source__T
65
34
  ):void
66
- export declare function be__delete<
67
- Val,
68
- ctx_T extends Ctx = Ctx
69
- >(
70
- be:Be<Val>,
71
- ctx:ctx_T
72
- ):void
73
35
  export declare function ctx__delete<
74
- Val,
36
+ val_T,
75
37
  ctx_T extends Ctx = Ctx
76
38
  >(
77
39
  ctx:ctx_T,
78
- be_OR_id:Be<Val>|string|symbol,
40
+ be_OR_id:Be<val_T>|string|symbol,
79
41
  is_source_?:is_source__T
80
42
  ):void
81
43
  export declare function be__has_<
82
44
  ctx_T extends Ctx = Ctx
83
45
  >(be_OR_id:Be<unknown>|string, ctx:ctx_T):boolean
84
- export declare function be__has__ctx_<
46
+ export declare function be__ctx_<
85
47
  ctx_T extends Ctx = Ctx
86
48
  >(be_OR_id:Be<unknown>|string, ctx:ctx_T):MapCtx
87
49
  export declare function be__val_<
88
- Val,
50
+ val_T,
89
51
  ctx_T extends Ctx = Ctx
90
- >(be_OR_id:Be<Val>|string, ctx:ctx_T):Val|unknown|null
91
- export declare type MapCtx = Map<Be<unknown>|string|symbol, unknown>
92
- export interface NestedMapCtx extends Array<NestedMapCtx|MapCtx> {
93
- }
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>
94
55
  export type Ctx = MapCtx|NestedMapCtx
95
56
  export declare type Be<
96
- Val,
57
+ val_T,
97
58
  ctx_T extends Ctx = Ctx
98
- > = ((ctx:ctx_T, params?:be_params_T)=>Val)&{
59
+ > = ((ctx:ctx_T)=>val_T)&{
60
+ is_be: true
99
61
  id?:string
100
62
  }
63
+ export type be_config_T = {
64
+ id?:string
65
+ is_source_?:is_source__T
66
+ }
101
67
  export declare type be__return_T<
102
- Val,
68
+ val_T,
103
69
  ctx_T extends Ctx = Ctx
104
- > = Be<Val, ctx_T>
70
+ > = Be<val_T, ctx_T>
105
71
  export declare type be_T<
106
- Val,
72
+ val_T,
107
73
  ctx_T extends Ctx = Ctx
108
- > = Be<Val, ctx_T>
109
- export declare type be__val__T<
110
- Val,
74
+ > = Be<val_T, ctx_T>
75
+ export declare type be__val__new_T<
76
+ val_T,
111
77
  ctx_T extends Ctx = Ctx
112
- > = (ctx:ctx_T, be:Be<Val, ctx_T>, params?:be_params_T)=>Val
113
- export interface be__params_T {
114
- is_source_?:is_source__T
115
- expired_?:expired__T
116
- be_?:typeof be_
117
- }
118
- export type be__opts_T = be__params_T
119
- export interface be_params_T {
120
- force?:boolean
121
- }
122
- export type be_opts_T = be_params_T
78
+ > = (ctx:ctx_T, be:Be<val_T, ctx_T>)=>val_T
123
79
  export type is_source__T = (map_ctx:MapCtx, ctx:Ctx)=>boolean
124
80
  export type expired__T = (ctx:Ctx)=>boolean
package/all/be_/index.js CHANGED
@@ -1,125 +1,59 @@
1
1
  import { globalThis__prop__ensure } from '../globalThis__prop__ensure/index.js'
2
- export * from './debug.js'
3
- let be_M_is_source_ = globalThis.be_M_is_source_ ||= new WeakMap()
4
- /** @typedef {import('./index.d.ts').Be}Be */
5
- /** @typedef {import('./index.d.ts').Ctx}Ctx */
6
- /** @typedef {import('./index.d.ts').MapCtx}MapCtx */
7
- /** @typedef {import('./index.d.ts').be__params_T}be__params_T */
8
- /** @typedef {import('./index.d.ts').be__val__T}be__val__T */
9
- /** @typedef {import('./index.d.ts').is_source__T}is_source__T */
2
+ /** @typedef {import('./index.d.ts').Be} */
3
+ /** @typedef {import('./index.d.ts').be_} */
4
+ /** @typedef {import('./index.d.ts').be_config_T} */
5
+ /** @typedef {import('./index.d.ts').Ctx} */
6
+ /** @typedef {import('./index.d.ts').MapCtx} */
7
+ /** @typedef {import('./index.d.ts').be__val__new_T} */
8
+ /** @typedef {import('./index.d.ts').is_source__T} */
10
9
  /**
11
10
  * Auto-memoization function for the Ctx.
12
11
  * Memoized on globalThis to allow packages being loaded multiple times, which can happen during bundling.
13
12
  *
14
13
  * Returns a function to ensure that a member id_OR_val_ is defined on a ctx object,
15
- * otherwise it creates the value using the val__OR_be__params factory function.
16
- * @param {string|be__val__T}id_OR_val_
17
- * @param {be__val__T|be__params_T}[val__OR_be__params]
18
- * @param {be__params_T}[be__params]
14
+ * otherwise it caches & uses the return value of val__new.
15
+ * @param {be__val__new_T}val__new
19
16
  * @returns {Be}
20
17
  * @private
21
18
  */
22
- export function globalThis__be_(
23
- id_OR_val_,
24
- val__OR_be__params,
25
- be__params
26
- ) {
27
- return globalThis__prop__ensure(
28
- Symbol.for(id_OR_val_),
29
- ()=>be_(
30
- id_OR_val_,
31
- val__OR_be__params,
32
- be__params))
33
- }
19
+ export function globalThis__be_(val__new) {
20
+ return globalThis__prop__ensure(Symbol.for(val__new), ()=>be_(val__new)) }
34
21
  /**
35
22
  * Auto-memoization function for the Ctx.
36
23
  *
37
24
  * Returns a function to ensure that a member id is defined on a Ctx,
38
- * otherwise it creates the value using the val_ factory function.
39
- * @param {string|be__val__T}id_OR_val__new
40
- * @param {be__val__T|be__params_T}[val__new_OR_be__params]
41
- * @param {be__params_T}[be__params]
25
+ * otherwise it caches & uses the return value of val__new.
26
+ * @param {be__val__new_T}val__new
27
+ * @param {be_config_T}[config]
42
28
  * @returns {Be}
43
29
  * @private
44
30
  */
45
- export function be_(
46
- id_OR_val__new,
47
- val__new_OR_be__params,
48
- be__params
49
- ) {
50
- /** @type {string} */
51
- let id
52
- /** @type {be__val__T} */
53
- let val__new
54
- /** @type {is_source__T} */
55
- let is_source_
56
- /** @type {expired__T} */
57
- let expired_
58
- if (typeof id_OR_val__new === 'string') {
59
- val__new = val__new_OR_be__params
60
- id = id_OR_val__new
61
- } else {
62
- val__new = id_OR_val__new
63
- be__params = val__new_OR_be__params
64
- }
65
- if (be__params) {
66
- is_source_ = be__params.is_source_
67
- expired_ = be__params.expired_
68
- }
69
- let be = (argv__ctx, params)=>{
70
- be_.argv__debug?.(argv__ctx)
71
- let saved__val = be__val_(be, argv__ctx)
72
- if (
73
- !params?.force
74
- && be__has_(be, argv__ctx)
75
- && !expired_?.(argv__ctx)
76
- ) {
77
- return saved__val
78
- }
79
- let ctx = source__map_ctx_(argv__ctx, is_source_)
80
- be_.source__debug?.(ctx)
81
- let pending = ctx.get(Symbol.for('pending'))
82
- if (!pending) {
83
- pending = new Map
84
- ctx.set(Symbol.for('pending'), pending)
85
- }
86
- be_.pending__debug?.(pending)
87
- pending.set(be, id || be)
88
- let val = val__new ? val__new(argv__ctx, be, params) : null
89
- ctx.set(be, val)
90
- if (id) {
91
- ctx.set(id, val)
31
+ export function be_(val__new, config) {
32
+ let be = argv__ctx=>{
33
+ let flat__argv__ctx = Array.isArray(argv__ctx) && argv__ctx.flat(Infinity)
34
+ let be__ctx =
35
+ flat__argv__ctx
36
+ ? flat__argv__ctx.find(ctx=>ctx.has(be))
37
+ : argv__ctx.has(be) && argv__ctx
38
+ if (!be__ctx) {
39
+ be__ctx =
40
+ flat__argv__ctx
41
+ ? flat__argv__ctx.find(ctx=>!be.is_source_ || be.is_source_(ctx, argv__ctx))
42
+ : (!be.is_source_ || be.is_source_(argv__ctx, argv__ctx)) && argv__ctx
43
+ // circular dependency state
44
+ // if val__new calls this be before returning, Symbol('cir') will be the value of this be
45
+ // 'cir' is used instead of 'circular' to reduce the payload by a few bytes
46
+ be__ctx.set(be, Symbol('cir'))
47
+ be__ctx.set(be, val__new(argv__ctx, be))
48
+ if (be.id) be__ctx.set(be.id, be__ctx.get(be))
92
49
  }
93
- pending.delete(be)
94
- return val
50
+ return be__ctx.get(be)
95
51
  }
96
- be_M_is_source_.set(be, is_source_)
97
- be.id = id
52
+ be.id = config?.id
53
+ be.is_source_ = config?.is_source_
54
+ be.is_be = true
98
55
  return be
99
56
  }
100
- export {
101
- be_ as _be,
102
- be_ as b_,
103
- be_ as _b,
104
- }
105
- /**
106
- * @param {Be}be
107
- * @returns {is_source__T}
108
- * @private
109
- */
110
- export function be__is_source__(be) {
111
- return be_M_is_source_.get(be)
112
- }
113
- /**
114
- * @param {Be}be
115
- * @param {Ctx}ctx
116
- * @param {unknown}val
117
- * @returns {unknown}
118
- * @private
119
- */
120
- export function be__set(be, ctx, val) {
121
- ctx__set(ctx, be, val, be__is_source__(be))
122
- }
123
57
  /**
124
58
  * @param {Ctx}ctx
125
59
  * @param {Be|string|symbol}be_OR_id
@@ -132,7 +66,7 @@ export function ctx__set(
132
66
  ctx,
133
67
  be_OR_id,
134
68
  val,
135
- is_source_
69
+ is_source_ = be_OR_id.is_source_
136
70
  ) {
137
71
  let source__map_ctx = source__map_ctx_(ctx, is_source_)
138
72
  if (source__map_ctx) {
@@ -143,18 +77,9 @@ export function ctx__set(
143
77
  }
144
78
  }
145
79
  }
146
- /**
147
- * @param {Be}be
148
- * @param {Ctx}ctx
149
- * @private
150
- */
151
- export function be__delete(be, ctx) {
152
- ctx__delete(ctx, be)
153
- }
154
80
  /**
155
81
  * @param {Ctx}ctx
156
82
  * @param {Be|string|symbol}be_OR_id
157
- * @param {is_source__T}[is_source_]
158
83
  */
159
84
  export function ctx__delete(
160
85
  ctx,
@@ -181,7 +106,7 @@ export function ctx__delete(
181
106
  * @private
182
107
  */
183
108
  export function be__has_(be_or_id, argv__ctx) {
184
- return Boolean(be__has__ctx_(be_or_id, argv__ctx))
109
+ return Boolean(be__ctx_(be_or_id, argv__ctx))
185
110
  }
186
111
  /**
187
112
  * @param {Be|string}be_or_id
@@ -189,17 +114,17 @@ export function be__has_(be_or_id, argv__ctx) {
189
114
  * @returns {MapCtx}
190
115
  * @private
191
116
  */
192
- export function be__has__ctx_(be_or_id, argv__ctx) {
117
+ export function be__ctx_(be_or_id, argv__ctx) {
193
118
  if (Array.isArray(argv__ctx)) {
194
- for (let i = 0; i < argv__ctx.length; i++) {
195
- const be__has__ctx = be__has__ctx_(be_or_id, argv__ctx[i])
196
- if (be__has__ctx) return be__has__ctx
119
+ for (let ctx of argv__ctx) {
120
+ let be__ctx = be__ctx_(be_or_id, ctx)
121
+ if (be__ctx) return be__ctx
197
122
  }
198
- return null
199
123
  } else {
200
- return argv__ctx.has(be_or_id) ? argv__ctx : null
124
+ if (argv__ctx.has(be_or_id)) return argv__ctx
201
125
  }
202
126
  }
127
+ export { be__ctx_ as be__has__ctx_ }
203
128
  /**
204
129
  * @param {Be|string}be_or_id
205
130
  * @param {Ctx}argv__ctx
@@ -207,30 +132,22 @@ export function be__has__ctx_(be_or_id, argv__ctx) {
207
132
  * @private
208
133
  */
209
134
  export function be__val_(be_or_id, argv__ctx) {
210
- if (Array.isArray(argv__ctx)) {
211
- for (let i = 0; i < argv__ctx.length; i++) {
212
- let ctx = argv__ctx[i]
213
- const be__has__ctx = be__has__ctx_(be_or_id, ctx)
214
- if (be__has__ctx) return be__has__ctx.get(be_or_id)
215
- }
216
- } else {
217
- return argv__ctx.get(be_or_id)
218
- }
135
+ let be__ctx = be__ctx_(be_or_id, argv__ctx)
136
+ if (be__ctx) return be__ctx.get(be_or_id)
219
137
  }
220
138
  /**
221
- * @param {Ctx}ctx
139
+ * @param {Ctx}argv__ctx
222
140
  * @param {is_source__T}is_source_
223
141
  * @returns {unknown}
224
142
  * @private
225
143
  */
226
- export function source__map_ctx_(ctx, is_source_) {
227
- if (Array.isArray(ctx)) {
228
- for (let i = 0; i < ctx.length; i++) {
229
- let i_ctx = ctx[i]
230
- let source__map_ctx = source__map_ctx_(i_ctx, is_source_)
144
+ export function source__map_ctx_(argv__ctx, is_source_) {
145
+ if (Array.isArray(argv__ctx)) {
146
+ for (let ctx of argv__ctx) {
147
+ let source__map_ctx = source__map_ctx_(ctx, is_source_)
231
148
  if (source__map_ctx) return source__map_ctx
232
149
  }
233
- } else if (!is_source_ || is_source_(/** @type {MapCtx} */ctx, ctx)) {
234
- return ctx
150
+ } else if (!is_source_ || is_source_(/** @type {MapCtx} */argv__ctx, argv__ctx)) {
151
+ return argv__ctx
235
152
  }
236
153
  }