@aidc-toolkit/dev 1.0.23-beta → 1.0.24-beta

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,74 +0,0 @@
1
- /**
2
- * Create an object with omitted or picked entries.
3
- *
4
- * @param omitting
5
- * True if omitting.
6
- *
7
- * @param o
8
- * Object.
9
- *
10
- * @param keys
11
- * Keys to omit or pick.
12
- *
13
- * @returns
14
- * Edited object.
15
- */
16
- function omitOrPick<Omitting extends boolean, T extends object, K extends keyof T>(omitting: Omitting, o: T, ...keys: K[]): Omitting extends true ? Omit<T, K> : Pick<T, K> {
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Key and value types are known.
18
- return Object.fromEntries(Object.entries(o).filter(([key]) => keys.includes(key as K) !== omitting)) as ReturnType<typeof omitOrPick<Omitting, T, K>>;
19
- }
20
-
21
- /**
22
- * Create an object with omitted entries.
23
- *
24
- * @param o
25
- * Object.
26
- *
27
- * @param keys
28
- * Keys to omit.
29
- *
30
- * @returns
31
- * Edited object.
32
- */
33
- export function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K> {
34
- return omitOrPick(true, o, ...keys);
35
- }
36
-
37
- /**
38
- * Create an object with picked entries.
39
- *
40
- * @param o
41
- * Object.
42
- *
43
- * @param keys
44
- * Keys to pick.
45
- *
46
- * @returns
47
- * Edited object.
48
- */
49
- export function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K> {
50
- return omitOrPick(false, o, ...keys);
51
- }
52
-
53
- /**
54
- * Cast a property as a more narrow type.
55
- *
56
- * @param o
57
- * Object.
58
- *
59
- * @param key
60
- * Key of property to cast.
61
- *
62
- * @returns
63
- * Single-key object with property cast as desired type.
64
- */
65
- export function propertyAs<TAsType extends T[K], T extends object, K extends keyof T>(o: T, key: K): Readonly<Omit<T, K> extends T ? Partial<Record<K, TAsType>> : Record<K, TAsType>> {
66
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is determined by condition.
67
- return (key in o ?
68
- {
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Force cast.
70
- [key]: o[key] as TAsType
71
- } :
72
- {}
73
- ) as ReturnType<typeof propertyAs<TAsType, T, K>>;
74
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig-build-local.json",
3
-
4
- "compilerOptions": {
5
- // Emit.
6
- "declarationMap": true,
7
- "sourceMap": true
8
- }
9
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig-build.json",
3
-
4
- "compilerOptions": {
5
- // Emit.
6
- "declarationMap": true,
7
- "sourceMap": true
8
- }
9
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
-
4
- "files": [
5
- "./src/index.ts"
6
- ],
7
-
8
- "compilerOptions": {
9
- "outDir": "./dist"
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.json",
3
-
4
- "files": [
5
- "../../../src/index.ts"
6
- ],
7
-
8
- "compilerOptions": {
9
- "outDir": "../../../dist"
10
- }
11
- }