lay-sing 0.2.1 → 0.3.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.
- package/README.md +14 -18
- package/esm/{test-utils → main}/expect.d.ts +34 -19
- package/esm/main/expect.d.ts.map +1 -0
- package/esm/main/expect.js.map +1 -0
- package/esm/main/index.d.ts +24 -11
- package/esm/main/index.d.ts.map +1 -1
- package/esm/main/index.js +5 -13
- package/esm/main/index.js.map +1 -1
- package/esm/main/noop.d.ts +27 -0
- package/esm/main/noop.d.ts.map +1 -0
- package/esm/{test-utils/index.js → main/noop.js} +1 -12
- package/esm/main/noop.js.map +1 -0
- package/esm/utils/compare/assignable.d.ts +30 -0
- package/esm/utils/compare/assignable.d.ts.map +1 -0
- package/esm/utils/compare/assignable.js +2 -0
- package/esm/utils/compare/assignable.js.map +1 -0
- package/esm/utils/compare/exact.d.ts +50 -0
- package/esm/utils/compare/exact.d.ts.map +1 -0
- package/esm/utils/compare/exact.js +2 -0
- package/esm/utils/compare/exact.js.map +1 -0
- package/esm/utils/compare/extends.d.ts +46 -0
- package/esm/utils/compare/extends.d.ts.map +1 -0
- package/esm/utils/compare/extends.js +2 -0
- package/esm/utils/compare/extends.js.map +1 -0
- package/esm/utils/compare/index.d.ts +5 -0
- package/esm/utils/compare/index.d.ts.map +1 -0
- package/esm/utils/compare/index.js +7 -0
- package/esm/utils/compare/index.js.map +1 -0
- package/esm/utils/compare/overlap.d.ts +47 -0
- package/esm/utils/compare/overlap.d.ts.map +1 -0
- package/esm/utils/compare/overlap.js +2 -0
- package/esm/utils/compare/overlap.js.map +1 -0
- package/esm/utils/index.d.ts +10 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +12 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/utils/logic/assert.d.ts +18 -0
- package/esm/utils/logic/assert.d.ts.map +1 -0
- package/esm/utils/logic/assert.js +2 -0
- package/esm/utils/logic/assert.js.map +1 -0
- package/esm/utils/logic/if.d.ts +37 -0
- package/esm/utils/logic/if.d.ts.map +1 -0
- package/esm/utils/logic/if.js +2 -0
- package/esm/utils/logic/if.js.map +1 -0
- package/esm/utils/logic/index.d.ts +4 -0
- package/esm/utils/logic/index.d.ts.map +1 -0
- package/esm/utils/logic/index.js +6 -0
- package/esm/utils/logic/index.js.map +1 -0
- package/{script/main/control.d.ts → esm/utils/logic/switch.d.ts} +14 -39
- package/esm/utils/logic/switch.d.ts.map +1 -0
- package/esm/utils/logic/switch.js +2 -0
- package/esm/utils/logic/switch.js.map +1 -0
- package/esm/utils/object/index.d.ts +4 -0
- package/esm/utils/object/index.d.ts.map +1 -0
- package/esm/utils/object/index.js +6 -0
- package/esm/utils/object/index.js.map +1 -0
- package/{script/main/key.d.ts → esm/utils/object/keys.d.ts} +34 -34
- package/esm/utils/object/keys.d.ts.map +1 -0
- package/esm/utils/object/keys.js +2 -0
- package/esm/utils/object/keys.js.map +1 -0
- package/esm/utils/object/pick.d.ts +16 -0
- package/esm/utils/object/pick.d.ts.map +1 -0
- package/esm/utils/object/pick.js +2 -0
- package/esm/utils/object/pick.js.map +1 -0
- package/esm/utils/object/props.d.ts +17 -0
- package/esm/utils/object/props.d.ts.map +1 -0
- package/esm/utils/object/props.js +2 -0
- package/esm/utils/object/props.js.map +1 -0
- package/esm/utils/tuple/append.d.ts +17 -0
- package/esm/utils/tuple/append.d.ts.map +1 -0
- package/esm/utils/tuple/append.js +2 -0
- package/esm/utils/tuple/append.js.map +1 -0
- package/esm/utils/tuple/concat.d.ts +31 -0
- package/esm/utils/tuple/concat.d.ts.map +1 -0
- package/esm/utils/tuple/concat.js +2 -0
- package/esm/utils/tuple/concat.js.map +1 -0
- package/esm/utils/tuple/includes.d.ts +20 -0
- package/esm/utils/tuple/includes.d.ts.map +1 -0
- package/esm/utils/tuple/includes.js +2 -0
- package/esm/utils/tuple/includes.js.map +1 -0
- package/esm/utils/tuple/index.d.ts +4 -0
- package/esm/utils/tuple/index.d.ts.map +1 -0
- package/esm/utils/tuple/index.js +6 -0
- package/esm/utils/tuple/index.js.map +1 -0
- package/package.json +5 -5
- package/script/{test-utils → main}/expect.d.ts +34 -19
- package/script/main/expect.d.ts.map +1 -0
- package/script/main/expect.js.map +1 -0
- package/script/main/index.d.ts +24 -11
- package/script/main/index.d.ts.map +1 -1
- package/script/main/index.js +8 -27
- package/script/main/index.js.map +1 -1
- package/script/main/noop.d.ts +27 -0
- package/script/main/noop.d.ts.map +1 -0
- package/script/{test-utils/index.js → main/noop.js} +1 -14
- package/script/main/noop.js.map +1 -0
- package/script/utils/compare/assignable.d.ts +30 -0
- package/script/utils/compare/assignable.d.ts.map +1 -0
- package/script/utils/compare/assignable.js +3 -0
- package/script/utils/compare/assignable.js.map +1 -0
- package/script/utils/compare/exact.d.ts +50 -0
- package/script/utils/compare/exact.d.ts.map +1 -0
- package/script/{main/async.js → utils/compare/exact.js} +1 -1
- package/script/utils/compare/exact.js.map +1 -0
- package/script/utils/compare/extends.d.ts +46 -0
- package/script/utils/compare/extends.d.ts.map +1 -0
- package/script/{main/boolean.js → utils/compare/extends.js} +1 -1
- package/script/utils/compare/extends.js.map +1 -0
- package/script/utils/compare/index.d.ts +5 -0
- package/script/utils/compare/index.d.ts.map +1 -0
- package/script/utils/compare/index.js +23 -0
- package/script/utils/compare/index.js.map +1 -0
- package/script/utils/compare/overlap.d.ts +47 -0
- package/script/utils/compare/overlap.d.ts.map +1 -0
- package/script/{main/control.js → utils/compare/overlap.js} +1 -1
- package/script/utils/compare/overlap.js.map +1 -0
- package/script/utils/index.d.ts +10 -0
- package/script/utils/index.d.ts.map +1 -0
- package/script/utils/index.js +28 -0
- package/script/utils/index.js.map +1 -0
- package/script/utils/logic/assert.d.ts +18 -0
- package/script/utils/logic/assert.d.ts.map +1 -0
- package/script/utils/logic/assert.js +3 -0
- package/script/utils/logic/assert.js.map +1 -0
- package/script/utils/logic/if.d.ts +37 -0
- package/script/utils/logic/if.d.ts.map +1 -0
- package/script/{main/type/set.js → utils/logic/if.js} +1 -1
- package/script/utils/logic/if.js.map +1 -0
- package/script/utils/logic/index.d.ts +4 -0
- package/script/utils/logic/index.d.ts.map +1 -0
- package/script/utils/logic/index.js +22 -0
- package/script/utils/logic/index.js.map +1 -0
- package/{esm/main/control.d.ts → script/utils/logic/switch.d.ts} +14 -39
- package/script/utils/logic/switch.d.ts.map +1 -0
- package/script/utils/logic/switch.js +3 -0
- package/script/utils/logic/switch.js.map +1 -0
- package/script/utils/object/index.d.ts +4 -0
- package/script/utils/object/index.d.ts.map +1 -0
- package/script/{main/type → utils/object}/index.js +3 -2
- package/script/utils/object/index.js.map +1 -0
- package/{esm/main/key.d.ts → script/utils/object/keys.d.ts} +34 -34
- package/script/utils/object/keys.d.ts.map +1 -0
- package/script/{main/json.js → utils/object/keys.js} +1 -1
- package/script/utils/object/keys.js.map +1 -0
- package/script/utils/object/pick.d.ts +16 -0
- package/script/utils/object/pick.d.ts.map +1 -0
- package/script/{main/key.js → utils/object/pick.js} +1 -1
- package/script/utils/object/pick.js.map +1 -0
- package/script/utils/object/props.d.ts +17 -0
- package/script/utils/object/props.d.ts.map +1 -0
- package/script/{main/doc.js → utils/object/props.js} +1 -1
- package/script/utils/object/props.js.map +1 -0
- package/script/utils/tuple/append.d.ts +17 -0
- package/script/utils/tuple/append.d.ts.map +1 -0
- package/script/utils/tuple/append.js +3 -0
- package/script/utils/tuple/append.js.map +1 -0
- package/script/utils/tuple/concat.d.ts +31 -0
- package/script/utils/tuple/concat.d.ts.map +1 -0
- package/script/utils/tuple/concat.js +3 -0
- package/script/utils/tuple/concat.js.map +1 -0
- package/script/utils/tuple/includes.d.ts +20 -0
- package/script/utils/tuple/includes.d.ts.map +1 -0
- package/script/utils/tuple/includes.js +3 -0
- package/script/utils/tuple/includes.js.map +1 -0
- package/script/utils/tuple/index.d.ts +4 -0
- package/script/utils/tuple/index.d.ts.map +1 -0
- package/script/utils/tuple/index.js +22 -0
- package/script/utils/tuple/index.js.map +1 -0
- package/esm/main/async.d.ts +0 -13
- package/esm/main/async.d.ts.map +0 -1
- package/esm/main/async.js +0 -2
- package/esm/main/async.js.map +0 -1
- package/esm/main/boolean.d.ts +0 -59
- package/esm/main/boolean.d.ts.map +0 -1
- package/esm/main/boolean.js +0 -2
- package/esm/main/boolean.js.map +0 -1
- package/esm/main/control.d.ts.map +0 -1
- package/esm/main/control.js +0 -2
- package/esm/main/control.js.map +0 -1
- package/esm/main/doc.d.ts +0 -56
- package/esm/main/doc.d.ts.map +0 -1
- package/esm/main/doc.js +0 -2
- package/esm/main/doc.js.map +0 -1
- package/esm/main/function.d.ts +0 -27
- package/esm/main/function.d.ts.map +0 -1
- package/esm/main/function.js +0 -2
- package/esm/main/function.js.map +0 -1
- package/esm/main/json.d.ts +0 -44
- package/esm/main/json.d.ts.map +0 -1
- package/esm/main/json.js +0 -2
- package/esm/main/json.js.map +0 -1
- package/esm/main/key.d.ts.map +0 -1
- package/esm/main/key.js +0 -2
- package/esm/main/key.js.map +0 -1
- package/esm/main/object.d.ts +0 -120
- package/esm/main/object.d.ts.map +0 -1
- package/esm/main/object.js +0 -2
- package/esm/main/object.js.map +0 -1
- package/esm/main/tuple.d.ts +0 -64
- package/esm/main/tuple.d.ts.map +0 -1
- package/esm/main/tuple.js +0 -2
- package/esm/main/tuple.js.map +0 -1
- package/esm/main/type/compare.d.ts +0 -169
- package/esm/main/type/compare.d.ts.map +0 -1
- package/esm/main/type/compare.js +0 -2
- package/esm/main/type/compare.js.map +0 -1
- package/esm/main/type/index.d.ts +0 -3
- package/esm/main/type/index.d.ts.map +0 -1
- package/esm/main/type/index.js +0 -5
- package/esm/main/type/index.js.map +0 -1
- package/esm/main/type/set.d.ts +0 -34
- package/esm/main/type/set.d.ts.map +0 -1
- package/esm/main/type/set.js +0 -2
- package/esm/main/type/set.js.map +0 -1
- package/esm/main/typed-array.d.ts +0 -5
- package/esm/main/typed-array.d.ts.map +0 -1
- package/esm/main/typed-array.js +0 -2
- package/esm/main/typed-array.js.map +0 -1
- package/esm/test-utils/compare.d.ts +0 -81
- package/esm/test-utils/compare.d.ts.map +0 -1
- package/esm/test-utils/compare.js +0 -2
- package/esm/test-utils/compare.js.map +0 -1
- package/esm/test-utils/expect.d.ts.map +0 -1
- package/esm/test-utils/expect.js.map +0 -1
- package/esm/test-utils/index.d.ts +0 -77
- package/esm/test-utils/index.d.ts.map +0 -1
- package/esm/test-utils/index.js.map +0 -1
- package/script/main/async.d.ts +0 -13
- package/script/main/async.d.ts.map +0 -1
- package/script/main/async.js.map +0 -1
- package/script/main/boolean.d.ts +0 -59
- package/script/main/boolean.d.ts.map +0 -1
- package/script/main/boolean.js.map +0 -1
- package/script/main/control.d.ts.map +0 -1
- package/script/main/control.js.map +0 -1
- package/script/main/doc.d.ts +0 -56
- package/script/main/doc.d.ts.map +0 -1
- package/script/main/doc.js.map +0 -1
- package/script/main/function.d.ts +0 -27
- package/script/main/function.d.ts.map +0 -1
- package/script/main/function.js +0 -3
- package/script/main/function.js.map +0 -1
- package/script/main/json.d.ts +0 -44
- package/script/main/json.d.ts.map +0 -1
- package/script/main/json.js.map +0 -1
- package/script/main/key.d.ts.map +0 -1
- package/script/main/key.js.map +0 -1
- package/script/main/object.d.ts +0 -120
- package/script/main/object.d.ts.map +0 -1
- package/script/main/object.js +0 -3
- package/script/main/object.js.map +0 -1
- package/script/main/tuple.d.ts +0 -64
- package/script/main/tuple.d.ts.map +0 -1
- package/script/main/tuple.js +0 -3
- package/script/main/tuple.js.map +0 -1
- package/script/main/type/compare.d.ts +0 -169
- package/script/main/type/compare.d.ts.map +0 -1
- package/script/main/type/compare.js +0 -3
- package/script/main/type/compare.js.map +0 -1
- package/script/main/type/index.d.ts +0 -3
- package/script/main/type/index.d.ts.map +0 -1
- package/script/main/type/index.js.map +0 -1
- package/script/main/type/set.d.ts +0 -34
- package/script/main/type/set.d.ts.map +0 -1
- package/script/main/type/set.js.map +0 -1
- package/script/main/typed-array.d.ts +0 -5
- package/script/main/typed-array.d.ts.map +0 -1
- package/script/main/typed-array.js +0 -3
- package/script/main/typed-array.js.map +0 -1
- package/script/test-utils/compare.d.ts +0 -81
- package/script/test-utils/compare.d.ts.map +0 -1
- package/script/test-utils/compare.js +0 -3
- package/script/test-utils/compare.js.map +0 -1
- package/script/test-utils/expect.d.ts.map +0 -1
- package/script/test-utils/expect.js.map +0 -1
- package/script/test-utils/index.d.ts +0 -77
- package/script/test-utils/index.d.ts.map +0 -1
- package/script/test-utils/index.js.map +0 -1
- /package/esm/{test-utils → main}/expect.js +0 -0
- /package/script/{test-utils → main}/expect.js +0 -0
package/script/main/async.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a value that can be either `T` or a Promise of `T`
|
|
3
|
-
*
|
|
4
|
-
* @template T - The underlying type that may or may not be wrapped in a Promise
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* type StringOrPromise = Awaitable<string>
|
|
9
|
-
* // Equivalent to: string | Promise<string>
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export type Awaitable<T> = Promise<T> | T;
|
|
13
|
-
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/main/async.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
package/script/main/async.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/main/async.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a value that can be either `T` or a Promise of `T`\n *\n * @template T - The underlying type that may or may not be wrapped in a Promise\n *\n * @example\n * ```ts\n * type StringOrPromise = Awaitable<string>\n * // Equivalent to: string | Promise<string>\n * ```\n */\nexport type Awaitable<T> = Promise<T> | T\n"]}
|
package/script/main/boolean.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Negates a boolean type
|
|
3
|
-
*
|
|
4
|
-
* @template T - The boolean type to negate
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
9
|
-
*
|
|
10
|
-
* expect<Not<true>>().toBeFalse
|
|
11
|
-
* expect<Not<false>>().toBeTrue
|
|
12
|
-
* expect<Not<boolean>>().toBe<boolean>().success
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export type Not<T extends boolean> = T extends true ? false : T extends false ? true : boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Logical AND operation on two boolean types
|
|
18
|
-
*
|
|
19
|
-
* @template A - The first boolean type to compare
|
|
20
|
-
* @template B - The second boolean type to compare
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
25
|
-
*
|
|
26
|
-
* expect<And<true, true>>().toBeTrue
|
|
27
|
-
* expect<And<true, false>>().toBeFalse
|
|
28
|
-
* expect<And<false, true>>().toBeFalse
|
|
29
|
-
* expect<And<false, false>>().toBeFalse
|
|
30
|
-
* expect<And<boolean, boolean>>().toBe<boolean>().success
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export type And<A extends boolean, B extends boolean> = A extends never ? never : [B] extends [never] ? never : (A extends true ? (B extends true ? true : false) : false);
|
|
34
|
-
/**
|
|
35
|
-
* Logical OR operation on two boolean types
|
|
36
|
-
*
|
|
37
|
-
* @template A - The first boolean type to compare
|
|
38
|
-
* @template B - The second boolean type to compare
|
|
39
|
-
*
|
|
40
|
-
* ### Result
|
|
41
|
-
*
|
|
42
|
-
* - `never`: if either `A` or `B` is `never`
|
|
43
|
-
* - `boolean`: if either `A` or `B` is `boolean` or `any`
|
|
44
|
-
* - `false`: if both `A` and `B` are `false`
|
|
45
|
-
* - `true`: otherwise
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
50
|
-
*
|
|
51
|
-
* expect<Or<true, true>>().toBeTrue
|
|
52
|
-
* expect<Or<true, false>>().toBeTrue
|
|
53
|
-
* expect<Or<false, true>>().toBeTrue
|
|
54
|
-
* expect<Or<false, false>>().toBeFalse
|
|
55
|
-
* expect<Or<boolean, false>>().toBe<boolean>().success
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export type Or<A extends boolean, B extends boolean> = [A] extends [never] ? never : [B] extends [never] ? never : [boolean] extends [A] ? boolean : [boolean] extends [B] ? boolean : true extends A ? true : true extends B ? true : false;
|
|
59
|
-
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/main/boolean.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,GACvD,CAAC,SAAS,KAAK,GAAG,IAAI,GACtB,OAAO,CAAA;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,GAAG,CACb,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,IACf,CAAC,SAAS,KAAK,GAAG,KAAK,GACvB,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,EAAE,CACZ,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,IACf,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAC3B,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAC/B,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAC/B,IAAI,SAAS,CAAC,GAAG,IAAI,GACrB,IAAI,SAAS,CAAC,GAAG,IAAI,GACrB,KAAK,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/main/boolean.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Negates a boolean type\n *\n * @template T - The boolean type to negate\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<Not<true>>().toBeFalse\n * expect<Not<false>>().toBeTrue\n * expect<Not<boolean>>().toBe<boolean>().success\n * ```\n */\nexport type Not<T extends boolean> = T extends true ? false\n : T extends false ? true\n : boolean\n\n/**\n * Logical AND operation on two boolean types\n *\n * @template A - The first boolean type to compare\n * @template B - The second boolean type to compare\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<And<true, true>>().toBeTrue\n * expect<And<true, false>>().toBeFalse\n * expect<And<false, true>>().toBeFalse\n * expect<And<false, false>>().toBeFalse\n * expect<And<boolean, boolean>>().toBe<boolean>().success\n * ```\n */\nexport type And<\n A extends boolean,\n B extends boolean,\n> = A extends never ? never\n : [B] extends [never] ? never\n : (A extends true ? (B extends true ? true : false) : false)\n\n/**\n * Logical OR operation on two boolean types\n *\n * @template A - The first boolean type to compare\n * @template B - The second boolean type to compare\n *\n * ### Result\n *\n * - `never`: if either `A` or `B` is `never`\n * - `boolean`: if either `A` or `B` is `boolean` or `any`\n * - `false`: if both `A` and `B` are `false`\n * - `true`: otherwise\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<Or<true, true>>().toBeTrue\n * expect<Or<true, false>>().toBeTrue\n * expect<Or<false, true>>().toBeTrue\n * expect<Or<false, false>>().toBeFalse\n * expect<Or<boolean, false>>().toBe<boolean>().success\n * ```\n */\nexport type Or<\n A extends boolean,\n B extends boolean,\n> = [A] extends [never] ? never\n : [B] extends [never] ? never\n : [boolean] extends [A] ? boolean\n : [boolean] extends [B] ? boolean\n : true extends A ? true\n : true extends B ? true\n : false\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/main/control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,IAAI,SAAS,SAAS,IAAI,GAAG,GAAG,GAAG,EAAE,CAAA;AAE9F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,IAAI,SAAS,SAAS,KAAK,GAAG,GAAG,GAAG,EAAE,CAAA;AAEpG;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AAE7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,CACrB,CAAC,EACD,KAAK,SAAS,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAC3C,OAAO,GAAG,KAAK,IACb,KAAK,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAC7C,KAAK,SAAS,CAAC,MAAM,SAAS,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,IAAI,GAAG,MAAM,GACpF,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,SAAS,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GACvF,CAAC,KAAK,CAAC,CACZ,GACC,OAAO,CAAA;AAEX;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,CACvB,CAAC,EACD,KAAK,SAAS,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAC3C,OAAO,GAAG,KAAK,IACb,KAAK,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAC7C,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC5B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,IAAI,SAAS,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,GAC5G,KAAK,CACV,GACC,OAAO,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/main/control.ts"],"names":[],"mappings":"","sourcesContent":["import type { Exact } from './type/compare.js'\n\n/**\n * Conditional type - returns `Yes` if condition `Condition` is true, otherwise returns `No`\n *\n * @template Condition - The boolean condition to check\n * @template Yes - The type to return if condition is true\n * @template No - The type to return if condition is false (defaults to `never`)\n *\n * @example\n * ```ts\n * type Result = If<true, 'yes', 'no'> // 'yes'\n * type Result2 = If<false, 'yes', 'no'> // 'no'\n * type BoolResult = If<boolean, 'yes', 'no'> // boolean\n * ```\n */\nexport type If<Condition extends boolean, Yes, No = never> = Condition extends true ? Yes : No\n\n/**\n * Conditional type - returns `Yes` if condition `Condition` is false, otherwise returns `No`\n *\n * @template Condition - The boolean condition to check\n * @template Yes - The type to return if condition is false\n * @template No - The type to return if condition is true (defaults to `never`)\n *\n * ### Result\n *\n * - `never`: if `Condition` is `never`\n * - `Yes`: if `Condition` is `false`\n * - `No`: if `Condition` is `true`\n *\n * @example\n * ```ts\n * type Result = IfFalse<false, 'yes', 'no'> // 'yes'\n * type Result2 = IfFalse<true, 'yes', 'no'> // 'no'\n * type BoolResult = IfFalse<boolean, 'yes', 'no'> // boolean\n * ```\n */\nexport type IfFalse<Condition extends boolean, Yes, No = never> = Condition extends false ? Yes : No\n\n/**\n * Case tuple type used with `SwitchExact` and `SwitchExtends`\n *\n * @template T - The condition type to match against\n * @template Result - The result type to return if match is found\n *\n * @example\n * ```ts\n * type MyCase = Case<1, 'one'>\n * // Equivalent to: [1, 'one']\n * ```\n *\n * @see SwitchExact\n */\nexport type Case<T = unknown, Result = unknown> = [T, Result]\n\n/**\n * Default case type used with `SwitchExact` and `SwitchExtends`\n *\n * @template T - The default result type\n *\n * @example\n * ```ts\n * type NameMap<id> = SwitchExact<id, [\n * [1, 'Alice'],\n * [2, 'Bob'],\n * ], DefaultCase<'Steve'>>\n * ```\n *\n * @see SwitchExact\n */\nexport type DefaultCase<T> = T\n\n/**\n * Switch type that uses exact matching logic\n *\n * **⚠️Important:** `T` parameter is not distributive. When `T` is a union type, it does not check each member separately.\n *\n * @template T - The type to match against cases\n * @template Cases - Array of case tuples, each tuple has the form [Condition, Result]\n * @template Default - Default result if no exact match is found (defaults to `never`)\n *\n * @example\n * ```ts\n * type Result = SwitchExact<2, [\n * [1, 'Alice'],\n * [2, 'Bob'],\n * [3, 'Charlie'],\n * ], DefaultCase<'Steve'>>\n *\n * // Result: 'Bob'\n * ```\n */\nexport type SwitchExact<\n T,\n Cases extends readonly [unknown, unknown][],\n Default = never,\n> = Cases extends [infer First, ...infer Rest] ? (\n First extends [infer Condition, infer Result] ? (Exact<T, Condition> extends true ? Result\n : (SwitchExact<T, Rest extends readonly [unknown, unknown][] ? Rest : never, Default>))\n : (never)\n )\n : Default\n\n/**\n * Switch type that uses 'extends' logic instead of 'Exact' logic\n *\n * **⚠️Important:** `T` parameter is not distributive. When `T` is a union type, it does not check each member separately.\n *\n * @template T - The type to match against cases\n * @template Cases - Array of case tuples, each tuple has the form [Condition, Result]\n * @template Default - Default result if no match is found (defaults to `never`)\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<\n * SwitchExtends<string, [\n * [number, boolean],\n * [string, boolean],\n * ], Error>\n * >().toBe<boolean>().success\n * ```\n */\nexport type SwitchExtends<\n T,\n Cases extends readonly [unknown, unknown][],\n Default = never,\n> = Cases extends [infer First, ...infer Rest] ? (\n First extends [infer C, infer R]\n ? ([T] extends [C] ? R : SwitchExtends<T, Rest extends readonly [unknown, unknown][] ? Rest : never, Default>)\n : never\n )\n : Default\n"]}
|
package/script/main/doc.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Append documentation or auxiliary metadata to type `T`
|
|
3
|
-
* without changing its shape.
|
|
4
|
-
*
|
|
5
|
-
* This type intersects `Doc` onto `T`, but only keeps the keys
|
|
6
|
-
* originally defined in `T`. As a result:
|
|
7
|
-
*
|
|
8
|
-
* - `Doc` cannot introduce new properties
|
|
9
|
-
* - Existing properties in `T` are preserved
|
|
10
|
-
* - `Doc` may further constrain or annotate existing properties
|
|
11
|
-
*
|
|
12
|
-
* This is typically used to attach JSDoc comments, branding,
|
|
13
|
-
* or editor-only metadata to an existing type while keeping
|
|
14
|
-
* its public structure intact.
|
|
15
|
-
*
|
|
16
|
-
* @template T - The target type to append documentation to
|
|
17
|
-
* @template Doc - The documentation or metadata type to append
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
22
|
-
*
|
|
23
|
-
* type User = { name: string; age: number }
|
|
24
|
-
* type UserWithDoc = AppendDoc<User, { name: string }>
|
|
25
|
-
*
|
|
26
|
-
* expect<UserWithDoc>().toBe<User>().success
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export type AppendDoc<T, Doc> = Pick<T & Doc, keyof T>;
|
|
30
|
-
/**
|
|
31
|
-
* Prepend documentation or auxiliary metadata to type `T`
|
|
32
|
-
* without changing its shape.
|
|
33
|
-
*
|
|
34
|
-
* This is similar to {@link AppendDoc}, but the intersection order
|
|
35
|
-
* is reversed (`Doc & T`), which can affect how property types,
|
|
36
|
-
* documentation, and hover information are presented by tooling.
|
|
37
|
-
*
|
|
38
|
-
* In practice, this allows `Doc` to act as a non-invasive,
|
|
39
|
-
* descriptive layer while ensuring `T` remains the authoritative
|
|
40
|
-
* source of truth for property types.
|
|
41
|
-
*
|
|
42
|
-
* @template T - The target type to prepend documentation to
|
|
43
|
-
* @template Doc - The documentation or metadata type to prepend
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
48
|
-
*
|
|
49
|
-
* type User = { name: string; age: number }
|
|
50
|
-
* type UserWithDoc = PrependDoc<User, { age: number }>
|
|
51
|
-
*
|
|
52
|
-
* expect<UserWithDoc>().toBe<User>().success
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export type PrependDoc<T, Doc> = Pick<Doc & T, keyof T>;
|
|
56
|
-
//# sourceMappingURL=doc.d.ts.map
|
package/script/main/doc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/main/doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA"}
|
package/script/main/doc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/main/doc.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Append documentation or auxiliary metadata to type `T`\n * without changing its shape.\n *\n * This type intersects `Doc` onto `T`, but only keeps the keys\n * originally defined in `T`. As a result:\n *\n * - `Doc` cannot introduce new properties\n * - Existing properties in `T` are preserved\n * - `Doc` may further constrain or annotate existing properties\n *\n * This is typically used to attach JSDoc comments, branding,\n * or editor-only metadata to an existing type while keeping\n * its public structure intact.\n *\n * @template T - The target type to append documentation to\n * @template Doc - The documentation or metadata type to append\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type User = { name: string; age: number }\n * type UserWithDoc = AppendDoc<User, { name: string }>\n *\n * expect<UserWithDoc>().toBe<User>().success\n * ```\n */\nexport type AppendDoc<T, Doc> = Pick<T & Doc, keyof T>\n\n/**\n * Prepend documentation or auxiliary metadata to type `T`\n * without changing its shape.\n *\n * This is similar to {@link AppendDoc}, but the intersection order\n * is reversed (`Doc & T`), which can affect how property types,\n * documentation, and hover information are presented by tooling.\n *\n * In practice, this allows `Doc` to act as a non-invasive,\n * descriptive layer while ensuring `T` remains the authoritative\n * source of truth for property types.\n *\n * @template T - The target type to prepend documentation to\n * @template Doc - The documentation or metadata type to prepend\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type User = { name: string; age: number }\n * type UserWithDoc = PrependDoc<User, { age: number }>\n *\n * expect<UserWithDoc>().toBe<User>().success\n * ```\n */\nexport type PrependDoc<T, Doc> = Pick<Doc & T, keyof T>\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a function with any parameters and a specific return type
|
|
3
|
-
*
|
|
4
|
-
* @template Return - The return type of the function
|
|
5
|
-
* @template Params - The parameters of the function as a tuple type
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* type NumberToStringFn = AnyFunction<string, [number]>
|
|
10
|
-
* // Equivalent to: (arg: number) => string
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export type AnyFunction<Return = any, Params extends any[] = any[]> = (...args: Params) => Return;
|
|
14
|
-
/**
|
|
15
|
-
* Represents a constructor function with any parameters and a specific return type
|
|
16
|
-
*
|
|
17
|
-
* @template Return - The type returned by the constructor function
|
|
18
|
-
* @template Params - The parameters of the constructor function as a tuple type
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* type StringConstructor = Constructor<string, [number]>
|
|
23
|
-
* // Equivalent to: new (arg: number) => string
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export type Constructor<Return = any, Params extends any[] = any[]> = new (...args: Params) => Return;
|
|
27
|
-
//# sourceMappingURL=function.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/main/function.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CACrB,MAAM,GAAG,GAAG,EACZ,MAAM,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,IAC1B,CAAC,GAAG,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;AAE/B;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CACrB,MAAM,GAAG,GAAG,EACZ,MAAM,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,IAC1B,KAAK,GAAG,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA"}
|
package/script/main/function.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/main/function.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a function with any parameters and a specific return type\n *\n * @template Return - The return type of the function\n * @template Params - The parameters of the function as a tuple type\n *\n * @example\n * ```ts\n * type NumberToStringFn = AnyFunction<string, [number]>\n * // Equivalent to: (arg: number) => string\n * ```\n */\nexport type AnyFunction<\n Return = any,\n Params extends any[] = any[],\n> = (...args: Params) => Return\n\n/**\n * Represents a constructor function with any parameters and a specific return type\n *\n * @template Return - The type returned by the constructor function\n * @template Params - The parameters of the constructor function as a tuple type\n *\n * @example\n * ```ts\n * type StringConstructor = Constructor<string, [number]>\n * // Equivalent to: new (arg: number) => string\n * ```\n */\nexport type Constructor<\n Return = any,\n Params extends any[] = any[],\n> = new (...args: Params) => Return\n"]}
|
package/script/main/json.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Primitive values allowed by the JSON specification.
|
|
3
|
-
*
|
|
4
|
-
* This represents the set of non-object, non-array values
|
|
5
|
-
* that can appear in valid JSON data.
|
|
6
|
-
*/
|
|
7
|
-
export type JsonPrimitive = string | number | boolean | null;
|
|
8
|
-
/**
|
|
9
|
-
* A JSON array.
|
|
10
|
-
*
|
|
11
|
-
* Each element of the array must itself be a valid `JsonValue`.
|
|
12
|
-
*/
|
|
13
|
-
export type JsonArray = JsonValue[];
|
|
14
|
-
/**
|
|
15
|
-
* A JSON object.
|
|
16
|
-
*
|
|
17
|
-
* Keys are strings, and values must be valid `JsonValue`s.
|
|
18
|
-
* This mirrors the object structure defined by the JSON specification.
|
|
19
|
-
*/
|
|
20
|
-
export type JsonObject = {
|
|
21
|
-
[key: string]: JsonValue;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Any valid JSON value.
|
|
25
|
-
*
|
|
26
|
-
* This is a strict representation of JSON data, suitable for
|
|
27
|
-
* describing the result of `JSON.parse`, serialized payloads,
|
|
28
|
-
* or schema-level JSON structures.
|
|
29
|
-
*/
|
|
30
|
-
export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
|
|
31
|
-
/**
|
|
32
|
-
* A JavaScript value that can be safely serialized to JSON.
|
|
33
|
-
*
|
|
34
|
-
* Unlike `JsonValue`, this type represents values *before*
|
|
35
|
-
* serialization, describing the set of recursive structures
|
|
36
|
-
* that `JSON.stringify` can handle.
|
|
37
|
-
*
|
|
38
|
-
* This is useful for constraining inputs that are expected to
|
|
39
|
-
* be JSON-serializable, rather than already being JSON data.
|
|
40
|
-
*/
|
|
41
|
-
export type Jsonable = string | number | boolean | null | Jsonable[] | {
|
|
42
|
-
[key: string]: Jsonable;
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=json.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/main/json.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAE5D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9D;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,QAAQ,EAAE,GACV;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA"}
|
package/script/main/json.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/main/json.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Primitive values allowed by the JSON specification.\n *\n * This represents the set of non-object, non-array values\n * that can appear in valid JSON data.\n */\nexport type JsonPrimitive = string | number | boolean | null\n\n/**\n * A JSON array.\n *\n * Each element of the array must itself be a valid `JsonValue`.\n */\nexport type JsonArray = JsonValue[]\n\n/**\n * A JSON object.\n *\n * Keys are strings, and values must be valid `JsonValue`s.\n * This mirrors the object structure defined by the JSON specification.\n */\nexport type JsonObject = { [key: string]: JsonValue }\n\n/**\n * Any valid JSON value.\n *\n * This is a strict representation of JSON data, suitable for\n * describing the result of `JSON.parse`, serialized payloads,\n * or schema-level JSON structures.\n */\nexport type JsonValue = JsonPrimitive | JsonArray | JsonObject\n\n/**\n * A JavaScript value that can be safely serialized to JSON.\n *\n * Unlike `JsonValue`, this type represents values *before*\n * serialization, describing the set of recursive structures\n * that `JSON.stringify` can handle.\n *\n * This is useful for constraining inputs that are expected to\n * be JSON-serializable, rather than already being JSON data.\n */\nexport type Jsonable =\n | string\n | number\n | boolean\n | null\n | Jsonable[]\n | { [key: string]: Jsonable }\n"]}
|
package/script/main/key.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../src/main/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,cAAc,CAAC,GAAG,EAAE,SAAS,IAAI,OAAO,CAClD;KACG,CAAC,IAAI,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CAC9E,CAAC,MAAM,GAAG,CAAC,EACZ,SAAS,CACV,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,eAAe,CAAC,GAAG,EAAE,SAAS,IAAI,OAAO,CACnD;KAAG,CAAC,IAAI,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,GAAG,CAAC,EAClF,SAAS,CACV,CAAA"}
|
package/script/main/key.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/main/key.ts"],"names":[],"mappings":"","sourcesContent":["import type { Exact } from './type/index.js'\n\n/**\n * Extracts the keys of an object whose **base value type** matches the specified `ValueType` (ignoring undefined from optional properties).\n *\n * This utility matches the underlying/base type of each property (stripping `undefined` added by optional modifiers `?`).\n * For optional properties (e.g., `a?: string`), the type is treated as `string` – no need to include `undefined` in `ValueType` to match.\n *\n * @template Obj - The target object type to extract keys from.\n * @template ValueType - The base type to match against property values (ignoring undefined from optional properties).\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * // Basic usage: match base type (non-optional property)\n * type A = { a: 1; b: 2; c: 1 };\n * expect<KeysOfBaseType<A, 1>>().toBe<'a' | 'c'>().success\n *\n * // Key difference: optional property matching (ignores undefined)\n * type B = { a?: string; b: string };\n * expect<KeysOfBaseType<B, string>>().toBe<'a' | 'b'>().success // matches base type of both\n * expect<KeysOfBaseType<B, string | undefined>>().toBe<never>().success // base type does not include undefined\n *\n * type C = { a: never; b: any; c: unknown };\n * expect<KeysOfBaseType<C, never>>().toBe<'a'>().success\n * expect<KeysOfBaseType<C, any>>().toBe<'b'>().success\n * expect<KeysOfBaseType<C, unknown>>().toBe<'c'>().success\n * ```\n */\nexport type KeysOfBaseType<Obj, ValueType> = Exclude<\n {\n [K in keyof Obj]: Exact<Required<Obj>[K], ValueType> extends true ? K : never\n }[keyof Obj],\n undefined\n>\n\n/**\n * Extracts the keys of an object whose **complete value type** exactly matches the specified `ValueType` (including undefined for optional properties).\n *\n * This utility strictly matches the full type of each property (including `undefined` added by optional modifiers `?`).\n * For optional properties (e.g., `a?: string`), the type is treated as `string | undefined` – to match, `ValueType` must include `undefined`.\n *\n * @template Obj - The target object type to extract keys from.\n * @template ValueType - The exact type to match against property values (including undefined for optional properties).\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * // Basic usage: match exact type (non-optional property)\n * type A = { a: 1; b: 2; c: 1 };\n * expect<KeysOfExactType<A, 1>>().toBe<'a' | 'c'>().success\n *\n * // Key difference: optional property matching (requires undefined in `ValueType`)\n * type B = { a?: string };\n * expect<KeysOfExactType<B, string | undefined>>().toBe<'a'>().success // matches complete type\n * expect<KeysOfExactType<B, string>>().toBe<never>().success // does not match complete type\n *\n * type C = { a: never; b: any; c: unknown };\n * expect<KeysOfExactType<C, never>>().toBe<'a'>().success\n * expect<KeysOfExactType<C, any>>().toBe<'b'>().success\n * expect<KeysOfExactType<C, unknown>>().toBe<'c'>().success\n * ```\n */\nexport type KeysOfExactType<Obj, ValueType> = Exclude<\n { [K in keyof Obj]: Exact<Obj[K], ValueType> extends true ? K : never }[keyof Obj],\n undefined\n>\n"]}
|
package/script/main/object.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { KeysOfExactType } from './key.js';
|
|
2
|
-
/**
|
|
3
|
-
* Get property type from object, with fallback for missing keys.
|
|
4
|
-
*
|
|
5
|
-
* @template Obj - The object type to access
|
|
6
|
-
* @template K - The key to access in the object
|
|
7
|
-
* @template E - The fallback type if the key doesn't exist (defaults to `never`)
|
|
8
|
-
*
|
|
9
|
-
* @returns `Obj[K]` if key exists, otherwise `E`.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
14
|
-
*
|
|
15
|
-
* type User = { name: string; age?: number };
|
|
16
|
-
*
|
|
17
|
-
* expect<Access<User, 'name'>>().toBe<string>().success
|
|
18
|
-
* expect<Access<User, 'age'>>().toBe<number | undefined>().success
|
|
19
|
-
* expect<Access<User, 'email', 'none'>>().toBe<'none'>().success
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export type Access<Obj, K extends PropertyKey, E = never> = K extends keyof Obj ? Obj[K] : E;
|
|
23
|
-
/**
|
|
24
|
-
* Inverse of `Access` - gets keys from an object that have values of a specific type
|
|
25
|
-
*
|
|
26
|
-
* @template T - The object type to inspect
|
|
27
|
-
* @template V - The value type to match against
|
|
28
|
-
* @template E - The fallback type if no keys match (defaults to `never`)
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
33
|
-
*
|
|
34
|
-
* expect<InverseAccess<{ a: string }, string>>().toBe<'a'>().success
|
|
35
|
-
* expect<InverseAccess<{ a: string; b: string }, string>>().toBe<'a' | 'b'>().success
|
|
36
|
-
* expect<InverseAccess<{ a: string }, number>>().toBe<never>().success
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export type InverseAccess<T, V, E = never> = {
|
|
40
|
-
[K in keyof T]: T[K] extends V ? K : E;
|
|
41
|
-
}[keyof T];
|
|
42
|
-
/**
|
|
43
|
-
* Recursively makes all properties of `T` optional
|
|
44
|
-
*
|
|
45
|
-
* @template T - The object type to make deep partial
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```ts
|
|
49
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
50
|
-
*
|
|
51
|
-
* type Result = DeepPartial<{ a: string; nested: { b: number } }>
|
|
52
|
-
* expect<Result>().toBe<{ a?: string; nested?: { b?: number } }>().success
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export type DeepPartial<T> = {
|
|
56
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Recursively makes all properties of `T` required
|
|
60
|
-
*
|
|
61
|
-
* @template T - The object type to make deep required
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
66
|
-
*
|
|
67
|
-
* expect<DeepRequire<{ _?: { _?: 1 } }>>().toBe<{ _: { _: 1 } }>().success
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export type DeepRequire<T> = {
|
|
71
|
-
[K in keyof T]-?: T[K] extends object | undefined ? DeepRequire<NonNullable<T[K]>> : T[K];
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* **⚠️Important:** parameter `T` and `U` are not distributive. When they are union type, it treats them as a single entity.
|
|
75
|
-
*
|
|
76
|
-
* @template T - The type to test (not distributed over unions)
|
|
77
|
-
* @template U - The constraint type to test against
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
*
|
|
81
|
-
* ```ts
|
|
82
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
83
|
-
*
|
|
84
|
-
* expect<AssertExtends<string, number>>().toBeNever
|
|
85
|
-
* expect<AssertExtends<1 | 2, 1>>().toBeNever
|
|
86
|
-
* expect<AssertExtends<1, 1 | 2>>().toBe<1>().success
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
export type AssertExtends<T, U> = [T] extends [U] ? T : never;
|
|
90
|
-
/**
|
|
91
|
-
* Safely picks keys `Key` from type `Obj`, excluding non-existent keys
|
|
92
|
-
*
|
|
93
|
-
* @template Obj - The object type to pick keys from
|
|
94
|
-
* @template Key - The keys to pick from the object
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
99
|
-
*
|
|
100
|
-
* type Result = SafePick<{ a: string; b: number }, 'a' | 'c'>
|
|
101
|
-
* expect<Result>().toBe<{ a: string }>().success
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
export type SafePick<Obj, Key> = Pick<Obj, Key & keyof Obj>;
|
|
105
|
-
/**
|
|
106
|
-
* Picks properties from `T` that have values of type `U`
|
|
107
|
-
*
|
|
108
|
-
* @template T - The object type to pick properties from
|
|
109
|
-
* @template U - The value type to match against
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
114
|
-
* type A = { a: string; b: number; c: string }
|
|
115
|
-
* type Strings = PropsOfBaseType<A, string> // { a: string; c: string }
|
|
116
|
-
* expect<PropsOfBaseType<A, string>>().toBe<{ a: string; c: string }>()
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
export type PropsOfBaseType<T, U> = Pick<T, KeysOfExactType<Required<T>, U>>;
|
|
120
|
-
//# sourceMappingURL=object.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/main/object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,WAAW,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;CAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AAEhG;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC1F,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE7D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,CAAC,CAAA;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA"}
|
package/script/main/object.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/main/object.ts"],"names":[],"mappings":"","sourcesContent":["import type { KeysOfExactType } from './key.js'\n\n/**\n * Get property type from object, with fallback for missing keys.\n *\n * @template Obj - The object type to access\n * @template K - The key to access in the object\n * @template E - The fallback type if the key doesn't exist (defaults to `never`)\n *\n * @returns `Obj[K]` if key exists, otherwise `E`.\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type User = { name: string; age?: number };\n *\n * expect<Access<User, 'name'>>().toBe<string>().success\n * expect<Access<User, 'age'>>().toBe<number | undefined>().success\n * expect<Access<User, 'email', 'none'>>().toBe<'none'>().success\n * ```\n */\nexport type Access<Obj, K extends PropertyKey, E = never> = K extends keyof Obj ? Obj[K] : E\n\n/**\n * Inverse of `Access` - gets keys from an object that have values of a specific type\n *\n * @template T - The object type to inspect\n * @template V - The value type to match against\n * @template E - The fallback type if no keys match (defaults to `never`)\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<InverseAccess<{ a: string }, string>>().toBe<'a'>().success\n * expect<InverseAccess<{ a: string; b: string }, string>>().toBe<'a' | 'b'>().success\n * expect<InverseAccess<{ a: string }, number>>().toBe<never>().success\n * ```\n */\nexport type InverseAccess<T, V, E = never> = { [K in keyof T]: T[K] extends V ? K : E }[keyof T]\n\n/**\n * Recursively makes all properties of `T` optional\n *\n * @template T - The object type to make deep partial\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type Result = DeepPartial<{ a: string; nested: { b: number } }>\n * expect<Result>().toBe<{ a?: string; nested?: { b?: number } }>().success\n * ```\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]\n}\n\n/**\n * Recursively makes all properties of `T` required\n *\n * @template T - The object type to make deep required\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<DeepRequire<{ _?: { _?: 1 } }>>().toBe<{ _: { _: 1 } }>().success\n * ```\n */\nexport type DeepRequire<T> = {\n [K in keyof T]-?: T[K] extends object | undefined ? DeepRequire<NonNullable<T[K]>> : T[K]\n}\n\n/**\n * **⚠️Important:** parameter `T` and `U` are not distributive. When they are union type, it treats them as a single entity.\n *\n * @template T - The type to test (not distributed over unions)\n * @template U - The constraint type to test against\n *\n * @example\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<AssertExtends<string, number>>().toBeNever\n * expect<AssertExtends<1 | 2, 1>>().toBeNever\n * expect<AssertExtends<1, 1 | 2>>().toBe<1>().success\n * ```\n */\nexport type AssertExtends<T, U> = [T] extends [U] ? T : never\n\n/**\n * Safely picks keys `Key` from type `Obj`, excluding non-existent keys\n *\n * @template Obj - The object type to pick keys from\n * @template Key - The keys to pick from the object\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type Result = SafePick<{ a: string; b: number }, 'a' | 'c'>\n * expect<Result>().toBe<{ a: string }>().success\n * ```\n */\nexport type SafePick<Obj, Key> = Pick<Obj, Key & keyof Obj>\n\n/**\n * Picks properties from `T` that have values of type `U`\n *\n * @template T - The object type to pick properties from\n * @template U - The value type to match against\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n * type A = { a: string; b: number; c: string }\n * type Strings = PropsOfBaseType<A, string> // { a: string; c: string }\n * expect<PropsOfBaseType<A, string>>().toBe<{ a: string; c: string }>()\n * ```\n */\nexport type PropsOfBaseType<T, U> = Pick<T, KeysOfExactType<Required<T>, U>>\n"]}
|
package/script/main/tuple.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Exact } from './type/compare.js';
|
|
2
|
-
/**
|
|
3
|
-
* Concatenates two tuples into a single tuple type
|
|
4
|
-
*
|
|
5
|
-
* @template Left - The first tuple type to concatenate
|
|
6
|
-
* @template Right - The second tuple type to concatenate
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
11
|
-
*
|
|
12
|
-
* expect<ConcatTuple<[1, 2], [3, 4]>>().toBe<[1, 2, 3, 4]>().success
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export type ConcatTuple<Left extends readonly unknown[], Right extends readonly unknown[]> = Left extends readonly unknown[] ? (Right extends readonly unknown[] ? [...Left, ...Right] : never) : never;
|
|
16
|
-
/**
|
|
17
|
-
* Checks whether a tuple includes a specific element type
|
|
18
|
-
*
|
|
19
|
-
* @template Tuple - The tuple type to check
|
|
20
|
-
* @template Element - The element type to look for
|
|
21
|
-
* @template Yes - The result if the element is found (defaults to `true`)
|
|
22
|
-
* @template No - The result if the element is not found (defaults to `false`)
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
27
|
-
*
|
|
28
|
-
* expect<IfTupleIncludes<[1, 2, 3], 2>>().toBeTrue
|
|
29
|
-
* expect<IfTupleIncludes<[1, 2, 3], 4>>().toBeFalse
|
|
30
|
-
* expect<IfTupleIncludes<[1, 2, 1], 1>>().toBeTrue
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export type IfTupleIncludes<Tuple extends readonly unknown[], Element, Yes = true, No = false> = Exact<Tuple, any> extends true ? never : Tuple extends readonly [infer First, ...infer Rest] ? (Exact<Element, First> extends true ? Yes : IfTupleIncludes<Rest, Element, Yes, No>) : No;
|
|
34
|
-
/**
|
|
35
|
-
* Appends an element to a tuple only if it doesn't already exist in the tuple
|
|
36
|
-
*
|
|
37
|
-
* @template Tuple - The tuple type to append to
|
|
38
|
-
* @template Element - The element type to append
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
43
|
-
*
|
|
44
|
-
* expect<AppendUnique<[1, 2, 3], 4>>().toBe<[1, 2, 3, 4]>().success
|
|
45
|
-
* expect<AppendUnique<[1, 2, 3], 2>>().toBe<[1, 2, 3]>().success
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export type AppendUnique<Tuple extends readonly unknown[], Element> = IfTupleIncludes<Tuple, Element> extends true ? Tuple : [...Tuple, Element];
|
|
49
|
-
/**
|
|
50
|
-
* Concatenates two tuples while ensuring uniqueness of elements
|
|
51
|
-
*
|
|
52
|
-
* @template Left - The first tuple type to concatenate
|
|
53
|
-
* @template Right - The second tuple type to concatenate
|
|
54
|
-
* @template R - The intermediate result tuple type (defaults to `Left`)
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* import { expect } from '@leawind/lay-sing/test-utils'
|
|
59
|
-
*
|
|
60
|
-
* expect<ConcatUniqueTuple<[1, 2, 3], [2, 3, 4]>>().toBe<[1, 2, 3, 4]>().success
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export type ConcatUniqueTuple<Left extends readonly unknown[], Right extends readonly unknown[], R extends readonly unknown[] = Left> = Right extends readonly [infer First, ...infer Rest] ? ConcatUniqueTuple<Left, Rest, AppendUnique<R, First>> : R;
|
|
64
|
-
//# sourceMappingURL=tuple.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../src/main/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,CACrB,IAAI,SAAS,SAAS,OAAO,EAAE,EAC/B,KAAK,SAAS,SAAS,OAAO,EAAE,IAC9B,IAAI,SAAS,SAAS,OAAO,EAAE,GAAG,CAAC,KAAK,SAAS,SAAS,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AAE9G;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,OAAO,EACP,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,IAAI,GAAG,KAAK,GACtC,KAAK,SAAS,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GACjD,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,IAAI,GAAG,GAAG,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GACtF,EAAE,CAAA;AAEN;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY,CACtB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,OAAO,IACL,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,EAAE,OAAO,CAAC,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,CAC3B,IAAI,SAAS,SAAS,OAAO,EAAE,EAC/B,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG,IAAI,IACjC,KAAK,SAAS,SAAS,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
package/script/main/tuple.js
DELETED
package/script/main/tuple.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../src/main/tuple.ts"],"names":[],"mappings":"","sourcesContent":["import type { Exact } from './type/compare.js'\n\n/**\n * Concatenates two tuples into a single tuple type\n *\n * @template Left - The first tuple type to concatenate\n * @template Right - The second tuple type to concatenate\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<ConcatTuple<[1, 2], [3, 4]>>().toBe<[1, 2, 3, 4]>().success\n * ```\n */\nexport type ConcatTuple<\n Left extends readonly unknown[],\n Right extends readonly unknown[],\n> = Left extends readonly unknown[] ? (Right extends readonly unknown[] ? [...Left, ...Right] : never) : never\n\n/**\n * Checks whether a tuple includes a specific element type\n *\n * @template Tuple - The tuple type to check\n * @template Element - The element type to look for\n * @template Yes - The result if the element is found (defaults to `true`)\n * @template No - The result if the element is not found (defaults to `false`)\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<IfTupleIncludes<[1, 2, 3], 2>>().toBeTrue\n * expect<IfTupleIncludes<[1, 2, 3], 4>>().toBeFalse\n * expect<IfTupleIncludes<[1, 2, 1], 1>>().toBeTrue\n * ```\n */\nexport type IfTupleIncludes<\n Tuple extends readonly unknown[],\n Element,\n Yes = true,\n No = false,\n> = Exact<Tuple, any> extends true ? never\n : Tuple extends readonly [infer First, ...infer Rest]\n ? (Exact<Element, First> extends true ? Yes : IfTupleIncludes<Rest, Element, Yes, No>)\n : No\n\n/**\n * Appends an element to a tuple only if it doesn't already exist in the tuple\n *\n * @template Tuple - The tuple type to append to\n * @template Element - The element type to append\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<AppendUnique<[1, 2, 3], 4>>().toBe<[1, 2, 3, 4]>().success\n * expect<AppendUnique<[1, 2, 3], 2>>().toBe<[1, 2, 3]>().success\n * ```\n */\nexport type AppendUnique<\n Tuple extends readonly unknown[],\n Element,\n> = IfTupleIncludes<Tuple, Element> extends true ? Tuple : [...Tuple, Element]\n\n/**\n * Concatenates two tuples while ensuring uniqueness of elements\n *\n * @template Left - The first tuple type to concatenate\n * @template Right - The second tuple type to concatenate\n * @template R - The intermediate result tuple type (defaults to `Left`)\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<ConcatUniqueTuple<[1, 2, 3], [2, 3, 4]>>().toBe<[1, 2, 3, 4]>().success\n * ```\n */\nexport type ConcatUniqueTuple<\n Left extends readonly unknown[],\n Right extends readonly unknown[],\n R extends readonly unknown[] = Left,\n> = Right extends readonly [infer First, ...infer Rest] ? ConcatUniqueTuple<Left, Rest, AppendUnique<R, First>> : R\n"]}
|