ctx-core 4.10.1 → 4.11.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.
@@ -1,4 +1,4 @@
1
1
  import type { NoRepetition } from '../NoRepetition/index.js'
2
2
  export type UnorderedTuple<
3
- MemberA extends any[] = any[]
3
+ MemberA extends unknown[] = unknown[]
4
4
  > = NoRepetition<string, MemberA>
@@ -77,4 +77,3 @@ export declare type be__val__new_T<
77
77
  ctx_T extends Ctx = Ctx
78
78
  > = (ctx:ctx_T, be:Be<val_T, ctx_T>)=>val_T
79
79
  export type is_source__T = (map_ctx:MapCtx, ctx:Ctx)=>boolean
80
- export type expired__T = (ctx:Ctx)=>boolean
@@ -1,12 +1,12 @@
1
1
  import type { nullish } from '../nullish/index.js'
2
+ import type { TupleExclude } from '../tup/index.js'
2
3
  export function nullish__none_<
3
- T extends any[], U
4
+ T extends unknown[], U
4
5
  >(
5
6
  $:T,
6
- _:(...$:T)=>U,
7
- onnullish?:(nullish:nullish)=>any
7
+ _:(...$:TupleExclude<T, nullish>)=>U,
8
+ onnullish?:(nullish:nullish)=>unknown
8
9
  ):U
9
10
  export {
10
11
  nullish__none_ as nullish__check_,
11
12
  }
12
-
@@ -2,8 +2,8 @@ import { test } from 'uvu'
2
2
  import { equal } from 'uvu/assert'
3
3
  import { nullish__none_ } from '../nullish__none/index.js'
4
4
  test('nullish__none_|-onnullish', ()=>{
5
- const arg_aa:any[][] = []
6
- const _ = (...arg_a:any[])=>{
5
+ const arg_aa:unknown[][] = []
6
+ const _ = (...arg_a:unknown[])=>{
7
7
  arg_aa.push(arg_a)
8
8
  return arg_a
9
9
  }
@@ -24,13 +24,13 @@ test('nullish__none_|-onnullish', ()=>{
24
24
  equal(arg_aa, [[zero], [str], [o]])
25
25
  })
26
26
  test('nullish__none_|+onnullish', ()=>{
27
- const arg_aa:any[][] = []
28
- const _ = (...arg_a:any[])=>{
27
+ const arg_aa:unknown[][] = []
28
+ const _ = (...arg_a:unknown[])=>{
29
29
  arg_aa.push(arg_a)
30
30
  return arg_a
31
31
  }
32
- const onnullish__arg_aa:any[][] = []
33
- const onnullish = (...arg_a:any[])=>{
32
+ const onnullish__arg_aa:unknown[][] = []
33
+ const onnullish = (...arg_a:unknown[])=>{
34
34
  onnullish__arg_aa.push(arg_a)
35
35
  return 'foobar'
36
36
  }
@@ -1,8 +1,8 @@
1
1
  export declare function tup<
2
- Args extends readonly any[]
2
+ Args extends readonly unknown[]
3
3
  >(...data:Args):Args
4
4
  export declare type tup_T<
5
- Args extends readonly any[]
5
+ Args extends readonly unknown[]
6
6
  > = (...data:Args)=>Args
7
7
  export {
8
8
  tup as tuple,
@@ -11,3 +11,23 @@ export {
11
11
  tup as _tup,
12
12
  tup as tup_fn,
13
13
  }
14
+ export type TupleRest<T extends unknown[]> =
15
+ T['length'] extends 0
16
+ ? undefined
17
+ : (((...b:T)=>void) extends (a:unknown, ...b:infer I)=>void ? I : [])
18
+ export type TupleFirst<T extends unknown[]> =
19
+ T['length'] extends 0 ? undefined : T[0]
20
+ type _TupleExclude<T extends unknown[], E, Rest> =
21
+ [Exclude<TupleFirst<T>, E>, Rest]
22
+ export interface TupleExclude<
23
+ T extends unknown[], E
24
+ > extends _TupleExclude<
25
+ T,
26
+ E,
27
+ TupleExclude<
28
+ // @ts-expect-error TS2344
29
+ TupleRest<T>,
30
+ E
31
+ >
32
+ > {
33
+ }
@@ -84,6 +84,7 @@ export * from '../all/tick/index.js'
84
84
  export * from '../all/Timeout/index.js'
85
85
  export * from '../all/timeout_promise/index.js'
86
86
  export * from '../all/times/index.js'
87
+ export * from '../all/tup/index.js'
87
88
  export * from '../all/tuple__o/index.js'
88
89
  export * from '../all/tuple_a_o/index.js'
89
90
  export * from '../all/tuple__union/index.js'
package/function/index.js CHANGED
@@ -84,6 +84,7 @@ export * from '../all/tick/index.js'
84
84
  export * from '../all/Timeout/index.js'
85
85
  export * from '../all/timeout_promise/index.js'
86
86
  export * from '../all/times/index.js'
87
+ export * from '../all/tup/index.js'
87
88
  export * from '../all/tuple__o/index.js'
88
89
  export * from '../all/tuple_a_o/index.js'
89
90
  export * from '../all/tuple__union/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctx-core",
3
- "version": "4.10.1",
3
+ "version": "4.11.1",
4
4
  "description": "ctx-core core library",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -106,14 +106,13 @@
106
106
  },
107
107
  "devDependencies": {
108
108
  "@arethetypeswrong/cli": "^0.13.3",
109
- "@size-limit/preset-small-lib": "^11.0.0",
110
- "@types/node": "^20.10.3",
109
+ "@size-limit/preset-small-lib": "^11.0.1",
110
+ "@types/node": "^20.10.4",
111
111
  "@types/sinon": "^17.0.2",
112
112
  "c8": "^8.0.1",
113
113
  "check-dts": "^0.7.2",
114
114
  "sinon": "^17.0.1",
115
- "size-limit": "^11.0.0",
116
- "ts-node": "^10.9.1",
115
+ "size-limit": "^11.0.1",
117
116
  "tsx": "^4.6.2",
118
117
  "typescript": "next",
119
118
  "uvu": "^0.5.6"