ctx-core 5.26.0 → 5.27.2

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/index.d.ts CHANGED
@@ -371,6 +371,7 @@ export * from './rmemo/index.js'
371
371
  export * from './rmemo__wait/index.js'
372
372
  export * from './round/index.js'
373
373
  export * from './run/index.js'
374
+ export * from './run_or_val/index.js'
374
375
  export * from './run_pipe/index.js'
375
376
  export * from './scalar__matrix__multiply/index.js'
376
377
  export * from './searchParams_o/index.js'
package/all/index.js CHANGED
@@ -371,6 +371,7 @@ export * from './rmemo/index.js'
371
371
  export * from './rmemo__wait/index.js'
372
372
  export * from './round/index.js'
373
373
  export * from './run/index.js'
374
+ export * from './run_or_val/index.js'
374
375
  export * from './run_pipe/index.js'
375
376
  export * from './scalar__matrix__multiply/index.js'
376
377
  export * from './searchParams_o/index.js'
@@ -0,0 +1,4 @@
1
+ export declare function run_or_val_<O, A extends unknown[] = unknown[]>(
2
+ fn_or_val:O|((...arg_a:A)=>O),
3
+ ...arg_a:A
4
+ ):O
@@ -0,0 +1,7 @@
1
+ export function run_or_val_(run_or_val, ...arg_a) {
2
+ return (
3
+ typeof run_or_val === 'function'
4
+ ? run_or_val(...arg_a)
5
+ : run_or_val
6
+ )
7
+ }
@@ -0,0 +1,15 @@
1
+ import { test } from 'uvu'
2
+ import { equal } from 'uvu/assert'
3
+ import { run_or_val_ } from './index.js'
4
+ test('run_or_val_', ()=>{
5
+ equal(run_or_val_(1), 1)
6
+ equal(run_or_val_(null), null)
7
+ equal(run_or_val_(()=>123), 123)
8
+ equal(run_or_val_(()=>null), null)
9
+ equal(run_or_val_(1, 'arg0', 'arg1'), 1)
10
+ equal(
11
+ run_or_val_(
12
+ (...arg_a)=>arg_a, 'arg0', 'arg1'),
13
+ ['arg0', 'arg1'])
14
+ })
15
+ test.run()
@@ -80,6 +80,7 @@ export * from '../all/resolver_curry/index.js'
80
80
  export * from '../all/right_and/index.js'
81
81
  export * from '../all/right_or/index.js'
82
82
  export * from '../all/run/index.js'
83
+ export * from '../all/run_or_val/index.js'
83
84
  export * from '../all/run_pipe/index.js'
84
85
  export * from '../all/sleep/index.js'
85
86
  export * from '../all/slice_arg_a/index.js'
package/function/index.js CHANGED
@@ -80,6 +80,7 @@ export * from '../all/resolver_curry/index.js'
80
80
  export * from '../all/right_and/index.js'
81
81
  export * from '../all/right_or/index.js'
82
82
  export * from '../all/run/index.js'
83
+ export * from '../all/run_or_val/index.js'
83
84
  export * from '../all/run_pipe/index.js'
84
85
  export * from '../all/sleep/index.js'
85
86
  export * from '../all/slice_arg_a/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-core",
3
- "version": "5.26.0",
3
+ "version": "5.27.2",
4
4
  "description": "ctx-core core library",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -134,14 +134,14 @@
134
134
  "./package.json": "./package.json"
135
135
  },
136
136
  "devDependencies": {
137
- "@arethetypeswrong/cli": "^0.13.5",
137
+ "@arethetypeswrong/cli": "^0.13.6",
138
138
  "@ctx-core/preprocess": "^0.1.1",
139
139
  "@size-limit/preset-small-lib": "^11.0.2",
140
140
  "@types/node": "^20.11.5",
141
141
  "@types/sinon": "^17.0.3",
142
142
  "c8": "^9.1.0",
143
143
  "check-dts": "^0.7.2",
144
- "esbuild": "^0.19.11",
144
+ "esbuild": "^0.19.12",
145
145
  "esmock": "^2.6.2",
146
146
  "sinon": "^17.0.1",
147
147
  "size-limit": "^11.0.2",
package/run/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export * from '../all/bind_map_call/index.js'
8
8
  export * from '../all/call/index.js'
9
9
  export * from '../all/call_fn_a/index.js'
10
10
  export * from '../all/call_or_fn/index.js'
11
- export * from '../all/tap/index.js'
12
11
  export * from '../all/run/index.js'
12
+ export * from '../all/run_or_val/index.js'
13
+ export * from '../all/tap/index.js'
package/run/index.js CHANGED
@@ -8,5 +8,6 @@ export * from '../all/bind_map_call/index.js'
8
8
  export * from '../all/call/index.js'
9
9
  export * from '../all/call_fn_a/index.js'
10
10
  export * from '../all/call_or_fn/index.js'
11
- export * from '../all/tap/index.js'
12
11
  export * from '../all/run/index.js'
12
+ export * from '../all/run_or_val/index.js'
13
+ export * from '../all/tap/index.js'