@avstantso/concepts 1.0.4 → 1.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 (45) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +98 -0
  3. package/package.json +6 -6
  4. package/dist/_global/async-tasks.d.ts +0 -134
  5. package/dist/_global/classic-enum.d.ts +0 -29
  6. package/dist/_global/compare/_register.d.ts +0 -32
  7. package/dist/_global/compare/combination.d.ts +0 -41
  8. package/dist/_global/compare/compare.d.ts +0 -39
  9. package/dist/_global/compare/index.d.ts +0 -4
  10. package/dist/_global/compare/structures.d.ts +0 -10
  11. package/dist/_global/conveyor.d.ts +0 -18
  12. package/dist/_global/equality/_register.d.ts +0 -35
  13. package/dist/_global/equality/equality.d.ts +0 -32
  14. package/dist/_global/equality/index.d.ts +0 -2
  15. package/dist/_global/extend/_register.d.ts +0 -76
  16. package/dist/_global/extend/index.d.ts +0 -1
  17. package/dist/_global/index.d.ts +0 -15
  18. package/dist/_global/mapping/_register.d.ts +0 -59
  19. package/dist/_global/mapping/index.d.ts +0 -2
  20. package/dist/_global/mapping/mapping.d.ts +0 -138
  21. package/dist/_global/mock.d.ts +0 -11
  22. package/dist/_global/override.d.ts +0 -50
  23. package/dist/_global/perform/_register.d.ts +0 -107
  24. package/dist/_global/perform/index.d.ts +0 -1
  25. package/dist/_global/provider/_register.d.ts +0 -16
  26. package/dist/_global/provider/combination.d.ts +0 -96
  27. package/dist/_global/provider/compare.d.ts +0 -47
  28. package/dist/_global/provider/extract.d.ts +0 -36
  29. package/dist/_global/provider/force.d.ts +0 -35
  30. package/dist/_global/provider/index.d.ts +0 -10
  31. package/dist/_global/provider/is.d.ts +0 -38
  32. package/dist/_global/provider/provider.d.ts +0 -85
  33. package/dist/_global/provider/strict.d.ts +0 -29
  34. package/dist/_global/provider/union.d.ts +0 -29
  35. package/dist/_global/provider/value.d.ts +0 -26
  36. package/dist/_global/stub.d.ts +0 -40
  37. package/dist/_global/switch/_register.d.ts +0 -45
  38. package/dist/_global/switch/index.d.ts +0 -2
  39. package/dist/_global/switch/switch.d.ts +0 -13
  40. package/dist/_global/transition.d.ts +0 -62
  41. package/dist/_global/value-wrap.d.ts +0 -12
  42. package/dist/export.d.ts +0 -16
  43. package/dist/index.d.ts +0 -4
  44. package/dist/index.js +0 -689
  45. package/dist/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.0] - 2026-01-18
6
+
7
+ ### Added
8
+
9
+ - `AbortSignal.Safe` - stub for functions that should not be called when signal is aborted
10
+
11
+ ### Changed
12
+
13
+ - Updated all dependencies
14
+
5
15
  ## [1.0.4] - 2026-01-16
6
16
 
7
17
  ### Changed
package/README.md CHANGED
@@ -20,6 +20,7 @@ AVStantso framework concepts providing reusable design patterns and abstractions
20
20
  - **Value Wrapper** - Value wrapping patterns with type preservation
21
21
  - **Async Tasks** - Asynchronous task management utilities
22
22
  - **Classic Enum** - Enhanced enum implementation with type safety
23
+ - **AbortSignal.Safe** - Extension for safe function execution with abort signals
23
24
 
24
25
  ## Installation
25
26
 
@@ -84,6 +85,7 @@ import type { Provider, Compare, Switch } from '@avstantso/concepts';
84
85
  - [Value Wrap](#value-wrap)
85
86
  - [Async Tasks](#async-tasks)
86
87
  - [Classic Enum](#classic-enum)
88
+ - [AbortSignal.Safe](#abortsignalsafe)
87
89
 
88
90
  ---
89
91
 
@@ -1641,6 +1643,102 @@ _Note: TypeScript numeric enums automatically create reverse mappings. For `enum
1641
1643
 
1642
1644
  ---
1643
1645
 
1646
+ ## AbortSignal.Safe
1647
+
1648
+ Extension for the native `AbortSignal` interface that provides safe function execution. Wraps functions to prevent their execution when the signal is aborted, returning `undefined` instead.
1649
+
1650
+ ### `signal.Safe`
1651
+
1652
+ A property on `AbortSignal` that returns a `Stub` for wrapping functions. Wrapped functions will not execute if the signal is aborted or if the function is undefined.
1653
+
1654
+ **Type Definition:**
1655
+
1656
+ ```typescript
1657
+ interface AbortSignal {
1658
+ Safe: AVStantso.Stub.One & AVStantso.Stub.Multiple;
1659
+ }
1660
+ ```
1661
+
1662
+ **Example:**
1663
+
1664
+ ```typescript
1665
+ import '@avstantso/concepts';
1666
+
1667
+ const controller = new AbortController();
1668
+ const { signal } = controller;
1669
+
1670
+ // Wrap a single function
1671
+ const fetchData = () => 'data';
1672
+ const safeFetch = signal.Safe(fetchData);
1673
+
1674
+ safeFetch(); // 'data' - executes normally
1675
+
1676
+ controller.abort();
1677
+
1678
+ safeFetch(); // undefined - signal is aborted, function not called
1679
+
1680
+ // Wrap multiple functions
1681
+ const controller2 = new AbortController();
1682
+ const { signal: signal2 } = controller2;
1683
+
1684
+ const [fn1, fn2, fn3] = signal2.Safe(
1685
+ () => 'first',
1686
+ (x: number) => x * 2,
1687
+ () => 'third'
1688
+ );
1689
+
1690
+ fn1(); // 'first'
1691
+ fn2(21); // 42
1692
+ fn3(); // 'third'
1693
+
1694
+ controller2.abort();
1695
+
1696
+ fn1(); // undefined
1697
+ fn2(21); // undefined
1698
+ fn3(); // undefined
1699
+
1700
+ // Handles undefined functions safely
1701
+ let maybeHandler: (() => void) | undefined;
1702
+ const safeHandler = signal.Safe(maybeHandler);
1703
+ safeHandler(); // undefined - no error even though function is undefined
1704
+
1705
+ // Practical use case: React effect cleanup
1706
+ useEffect(() => {
1707
+ const controller = new AbortController();
1708
+ const { signal } = controller;
1709
+
1710
+ fetchData({ signal }).then(signal.Safe(setState));
1711
+
1712
+ return () => controller.abort();
1713
+ }, []);
1714
+
1715
+ // Practical use case: cancelable async operations
1716
+ async function loadWithCancel(signal: AbortSignal) {
1717
+ const data = await fetchAPI('/data', { signal });
1718
+
1719
+ // Only update UI if not aborted
1720
+ signal.Safe(updateUI)(data);
1721
+ signal.Safe(showNotification)('Data loaded');
1722
+ }
1723
+ ```
1724
+
1725
+ **Behavior:**
1726
+
1727
+ - Returns `undefined` if `signal.aborted` is `true`
1728
+ - Returns `undefined` if the wrapped function is `undefined` or falsy
1729
+ - Otherwise executes the function normally and returns its result
1730
+ - Works with both single functions and multiple functions (array destructuring)
1731
+ - Re-evaluates `signal.aborted` on each call (not cached at wrap time)
1732
+
1733
+ **Use Cases:**
1734
+
1735
+ - **React Effects**: Prevent state updates after component unmount
1736
+ - **Async Operations**: Skip callbacks when operation is canceled
1737
+ - **Event Handlers**: Safely ignore events after cleanup
1738
+ - **Timeout/Interval Callbacks**: Prevent execution after cancellation
1739
+
1740
+ ---
1741
+
1644
1742
  ## Requirements
1645
1743
 
1646
1744
  - TypeScript >= 5.0
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@avstantso/concepts",
3
3
  "license": "MIT",
4
4
  "author": "avstantso",
5
- "version": "1.0.4",
5
+ "version": "1.1.0",
6
6
  "description": "AVStantso framework concepts",
7
7
  "keywords": [
8
8
  "Perform",
@@ -34,11 +34,11 @@
34
34
  "test": "NODE_ENV=test jest --coverage"
35
35
  },
36
36
  "dependencies": {
37
- "@avstantso/core": "1.0.4",
38
- "@avstantso/errors": "1.0.5",
39
- "@avstantso/js": "1.0.4",
40
- "@avstantso/std-ext": "1.0.2",
41
- "@avstantso/ts": "1.0.4"
37
+ "@avstantso/core": "1.1.0",
38
+ "@avstantso/errors": "1.1.0",
39
+ "@avstantso/js": "1.1.0",
40
+ "@avstantso/std-ext": "1.1.0",
41
+ "@avstantso/ts": "1.1.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@avstantso/dev-basic": "1.0.0"
@@ -1,134 +0,0 @@
1
- declare namespace AVStantso {
2
- /**
3
- * @summary Async tasks manager with gracefully finalization: for async tasks, intervals & timers
4
- */
5
- namespace AsyncTasksManager {
6
- /**
7
- * @summary Finalization options
8
- */
9
- type FinalOptions = {
10
- /**
11
- * @summary If not `quiet` send all errors to `console.error`
12
- */
13
- quiet?: boolean;
14
- };
15
- /**
16
- * @summary Timeouts types
17
- */
18
- namespace Timeout {
19
- /**
20
- * @summary Timeout options
21
- */
22
- type Options = {
23
- /**
24
- * @summary Call interval/timeout callback on finalize
25
- */
26
- callOnFinal?: boolean;
27
- };
28
- /**
29
- * @summary Timeout callback
30
- */
31
- type CallBack = (final?: boolean) => unknown;
32
- /**
33
- * @summary Timeout delay
34
- */
35
- type Delay = Parameters<typeof setInterval>[1];
36
- /**
37
- * @summary Timeout internal map value
38
- */
39
- type Value = [CallBack, Options];
40
- /**
41
- * @summary Timeout internal map
42
- */
43
- type Map = globalThis.Map<NodeJS.Timeout, Value>;
44
- }
45
- /**
46
- * @summary AsyncTasksManager option for external usage
47
- */
48
- type Option = {
49
- /**
50
- * @summary Async manager for register tasks.\
51
- * - if falsy — not used
52
- * - if `AsyncTasksManager` instance — use it
53
- * - if truthy — use global `AsyncTasksManager`
54
- */
55
- manager?: AsyncTasksManager | boolean;
56
- };
57
- }
58
- interface AsyncTasksManager {
59
- /**
60
- * @summary Gracefully finalization for async tasks, intervals & timers
61
- * @param options Finalization options
62
- */
63
- final(options?: AsyncTasksManager.FinalOptions): Promise<void>;
64
- /**
65
- * @summary All errors that was thrown inside `final`.\
66
- * Accessible only after final is called
67
- */
68
- readonly errors?: unknown[];
69
- /**
70
- * @summary Wrap of standard `setInterval`
71
- * @param callback Callback for interval
72
- * @param delay Interval delay
73
- * @param options Interval finalization options
74
- * @returns Interval id
75
- */
76
- setInterval(callback: AsyncTasksManager.Timeout.CallBack, delay: AsyncTasksManager.Timeout.Delay, options: AsyncTasksManager.Timeout.Options): ReturnType<typeof setInterval>;
77
- /**
78
- * @summary Wrap of standard `clearInterval`
79
- * @param timeout Timeout id
80
- */
81
- clearInterval: typeof clearInterval;
82
- /**
83
- * @summary Wrap of standard `setTimeout`
84
- * @param callback Callback for timeout
85
- * @param delay Timeout delay
86
- * @param options Timeout finalization options
87
- * @returns Timeout id
88
- */
89
- setTimeout(callback: AsyncTasksManager.Timeout.CallBack, delay: AsyncTasksManager.Timeout.Delay, options: AsyncTasksManager.Timeout.Options): ReturnType<typeof setTimeout>;
90
- /**
91
- * @summary Wrap of standard `clearTimeout`
92
- * @param timeout Timeout id
93
- */
94
- clearTimeout: typeof clearTimeout;
95
- /**
96
- * @summary Register async task
97
- * @template T Task result type
98
- * @param task Async task
99
- * @returns Async task (registered in manager)
100
- */
101
- regTask<T>(task: Promise<T>): Promise<T>;
102
- }
103
- namespace Code {
104
- /**
105
- * @summary Global Async tasks manager and utilities
106
- */
107
- namespace AsyncTasksManager {
108
- type ExtenderCallback = (instance: AVStantso.AsyncTasksManager) => void;
109
- type Utilities = {
110
- /**
111
- * @summary Register on create extender.\
112
- * Unavailable after call `AVStantso.freeze` method
113
- */
114
- _RegOnCreate?(extenderCallback: AsyncTasksManager.ExtenderCallback): void;
115
- /**
116
- * @summary Create new instance of `AsyncTasksManager`
117
- */
118
- Factory(): AVStantso.AsyncTasksManager;
119
- /**
120
- * @summary Check `candidate` is `AsyncTasksManager`
121
- */
122
- is(candidate: unknown): candidate is AVStantso.AsyncTasksManager;
123
- };
124
- }
125
- type AsyncTasksManager = AVStantso.AsyncTasksManager & AsyncTasksManager.Utilities;
126
- }
127
- interface Code {
128
- /**
129
- * @summary Global Async tasks manager and utilities
130
- */
131
- AsyncTasksManager: Code.AsyncTasksManager;
132
- }
133
- const AsyncTasksManager: Code.AsyncTasksManager;
134
- }
@@ -1,29 +0,0 @@
1
- declare namespace AVStantso {
2
- /**
3
- * @summary Classic TypeScript `enum` helpers
4
- */
5
- namespace ClassicEnum {
6
- /**
7
- * @summary `enum` `[key, value]` pairs
8
- */
9
- type Entry<T, K extends keyof T = Extract<keyof T, string>> = T extends object ? [K, T[K]] : never;
10
- }
11
- namespace Code {
12
- /**
13
- * @summary ClassicEnum utilities
14
- */
15
- interface ClassicEnum {
16
- /**
17
- * @summary Get enum entries without `[value, key]` pairs
18
- */
19
- entries<T>(enumType: T): AVStantso.ClassicEnum.Entry<T>[];
20
- }
21
- }
22
- interface Code {
23
- /**
24
- * @summary ClassicEnum utilities
25
- */
26
- ClassicEnum: Code.ClassicEnum;
27
- }
28
- const ClassicEnum: Code.ClassicEnum;
29
- }
@@ -1,32 +0,0 @@
1
- declare namespace AVStantso {
2
- namespace Code {
3
- /**
4
- * @summary Compare helpers utility
5
- */
6
- interface Compare {
7
- /**
8
- * @summary Low-lewel extend compare function. Add `Compare.Extended<TBase>`
9
- * @param compareFunc Function to extend
10
- */
11
- Extend<TBase>(compareFunc: AVStantso.Compare.Func<TBase>): AVStantso.Compare<TBase>;
12
- /**
13
- * @summary Create low-lewel sort-part function for `undefined`, `null`, 'NaN'
14
- * @param allowNaN Allow check 'NaN'
15
- * @param nullsFirst If `true` — `undefined`, `null`, 'NaN' has higher priority
16
- */
17
- ToNulls(allowNaN?: boolean, nullsFirst?: boolean): (x: unknown) => number;
18
- /**
19
- * @summary Select first non-zero comparison
20
- * @returns First non-zero comparison or `0` if its`s not found
21
- */
22
- Select(...comparisons: AVStantso.Perform<number>[]): number;
23
- }
24
- }
25
- interface Code {
26
- /**
27
- * @summary Compare helpers utility
28
- */
29
- Compare: Code.Compare;
30
- }
31
- const Compare: Code.Compare;
32
- }
@@ -1,41 +0,0 @@
1
- declare namespace AVStantso {
2
- namespace Compare {
3
- type _Combination<TCompares extends readonly Union[], R = unknown> = TCompares extends readonly [infer C extends Union, ...infer Rest extends readonly Union[]] ? _Combination<Rest, R & Extract<Value<C>[__BASE_TYPE__], object>> : Compare<{
4
- [K in keyof R]: R[K];
5
- }>;
6
- /**
7
- * @summary Create combined structural `Compare` by array of structural compares
8
- * @template TCompares Array of structural compares
9
- * @returns Combined structural `Compare`
10
- * @example
11
- * type cmpId = AVStantso.Provider.Compare.Make<'id', string>;
12
- * type cmpName = AVStantso.Provider.Compare.Make<'name', string>;
13
- * type cmpVersion = AVStantso.Provider.Compare.Make<'version', number>;
14
- *
15
- * type c = Combination<[cmpId, cmpName, cmpVersion]>;
16
- *
17
- * type t = CheckType<c, Compare<{ id: string; name: string; version: number; }>>;
18
- */
19
- export type Combination<TCompares extends Union[]> = _Combination<TCompares>;
20
- export {};
21
- }
22
- namespace Code {
23
- interface Compare {
24
- /**
25
- * @summary Create combined structural `Compare` by array of structural compares
26
- * @template R Result
27
- * @template TCompares Array of structural compares
28
- * @returns Combined structural `Compare` as `R`
29
- * @example
30
- * const cmpId = Provider.Compare('id', 'string');
31
- * const cmpName = Provider.Compare('name', 'string');
32
- * const cmpVersion = Provider.Compare('version', 'number');
33
- *
34
- * const c = Compare.Combine(cmpId, cmpName, cmpVersion);
35
- *
36
- * type t = CheckType<typeof c, Compare<{ id: string; name: string; version: number; }>>;
37
- */
38
- Combine<R extends AVStantso.Compare.Combination<TCompares>, TCompares extends AVStantso.Compare.Union[] = AVStantso.Compare.Union[]>(...compares: TCompares): R;
39
- }
40
- }
41
- }
@@ -1,39 +0,0 @@
1
- declare namespace AVStantso {
2
- /**
3
- * @summary Compare two values function
4
- */
5
- type Compare<TBase = unknown> = Compare.Func<TBase> & Compare.Extended<TBase> & {
6
- __BASE_TYPE__?: TBase;
7
- };
8
- namespace Compare {
9
- /**
10
- * @summary Compare two values atomic function
11
- */
12
- type Func<TBase = unknown> = <A extends TBase = TBase, B extends TBase = TBase>(a: A, b: B) => number;
13
- /**
14
- * @summary `Compare` extended properties & methods
15
- */
16
- type Extended<TBase = unknown> = {
17
- /**
18
- * @summary Cast `Compare` function basetype
19
- */
20
- as?<R extends TBase>(): Compare<R>;
21
- /**
22
- * @summary Create descending `Compare` function
23
- */
24
- desc?: Compare<TBase>;
25
- };
26
- /**
27
- * @summary Compare provider
28
- */
29
- type Provider = AVStantso.Provider.Strict.KeyValue<'Compare', Compare>;
30
- /**
31
- * @summary Compare union
32
- */
33
- type Union = AVStantso.Provider.Union<Provider>;
34
- /**
35
- * @summary Compare value of `U`
36
- */
37
- type Value<U extends Union> = AVStantso.Provider.Value<U, Provider>;
38
- }
39
- }
@@ -1,4 +0,0 @@
1
- import './_register';
2
- import './compare';
3
- import './combination';
4
- import './structures';
@@ -1,10 +0,0 @@
1
- declare namespace AVStantso {
2
- namespace Code {
3
- interface Compare {
4
- /**
5
- * @summary Structures objects compare
6
- */
7
- Structures: AVStantso.Compare<object>;
8
- }
9
- }
10
- }
@@ -1,18 +0,0 @@
1
- declare namespace AVStantso {
2
- /**
3
- * @summary Conveyor of handling
4
- */
5
- namespace Conveyor {
6
- /**
7
- * @summary Conveyor transformer
8
- */
9
- type Transformer<T> = (from: T) => T;
10
- }
11
- interface Code {
12
- /**
13
- * @summary Conveyor of handling. Ignore empty stages
14
- */
15
- Conveyor<T>(original: T, ...transformers: Conveyor.Transformer<T>[]): T;
16
- }
17
- const Conveyor: Code['Conveyor'];
18
- }
@@ -1,35 +0,0 @@
1
- declare namespace AVStantso {
2
- namespace Code {
3
- namespace Equality {
4
- /**
5
- * @summary `AVStantso.Equality.Predicate` utility
6
- */
7
- interface Predicate {
8
- /**
9
- * @summary Factory function for `AVStantso.Equality.Predicate`
10
- */
11
- Factory<T = unknown>(equality: AVStantso.Equality<T>): AVStantso.Equality.Predicate.Factory<T>;
12
- }
13
- }
14
- /**
15
- * @summary `AVStantso.Equality` utility
16
- */
17
- interface Equality {
18
- /**
19
- * @summary `AVStantso.Equality.Predicate` utility
20
- */
21
- Predicate: Equality.Predicate;
22
- /**
23
- * @summary Create equality from compare
24
- */
25
- From<T = unknown>(compare: AVStantso.Compare<T>): AVStantso.Equality<T>;
26
- }
27
- }
28
- interface Code {
29
- /**
30
- * @summary `AVStantso.Equality` utility
31
- */
32
- Equality: Code.Equality;
33
- }
34
- const Equality: Code.Equality;
35
- }
@@ -1,32 +0,0 @@
1
- declare namespace AVStantso {
2
- /**
3
- * @summary Equality function for two values
4
- */
5
- type Equality<TBase = unknown> = Equality.Func<TBase> & {
6
- __BASE_TYPE__?: TBase;
7
- /**
8
- * @summary Cast `Equality` function basetype
9
- */
10
- as?<T extends TBase>(): Equality<T>;
11
- };
12
- namespace Equality {
13
- /**
14
- * @summary Equality atomic function for two values
15
- */
16
- type Func<TBase = unknown> = <A extends TBase = TBase, B extends TBase = TBase>(a: A, b: B) => boolean;
17
- /**
18
- * @summary Equality function from compare function
19
- */
20
- type From<C extends Compare> = Equality<C[__BASE_TYPE__]>;
21
- /**
22
- * @summary Predicate of equality function
23
- */
24
- type Predicate<T = unknown> = (b: T) => boolean;
25
- namespace Predicate {
26
- /**
27
- * @summary Factory function for `AVStantso.Equality.Predicate`
28
- */
29
- type Factory<T = unknown> = (a: T, notEquals?: boolean) => Predicate<T>;
30
- }
31
- }
32
- }
@@ -1,2 +0,0 @@
1
- import './_register';
2
- import './equality';
@@ -1,76 +0,0 @@
1
- declare namespace AVStantso {
2
- namespace Extend {
3
- namespace ByRecord {
4
- type Original = object | Function;
5
- type Extender<TOriginal extends Original, TExtensionKey extends TS.Key, TExtensionItem, TExtensionValue = TExtensionKey> = (value: TExtensionValue, original?: TOriginal, key?: TExtensionKey) => TExtensionItem;
6
- type Func<TExtensionKey extends TS.Key, TExtensionValue, TCustomKey extends TS.Key = TExtensionKey> = <TOriginal extends Extend.ByRecord.Original, TExtensionItem, TExtension extends Record<TCustomKey, TExtensionItem>>(original: TOriginal, extender: Extend.ByRecord.Extender<TOriginal, TExtensionKey, TExtensionItem, TExtensionValue>) => TOriginal & TExtension;
7
- type Methods<TExtensionKey extends TS.Key, TExtensionValue, TCustomKey extends TS.Key = TExtensionKey> = Func<TExtensionKey, TExtensionValue, TCustomKey> & {
8
- static: Func<TExtensionKey, TExtensionValue, TCustomKey>;
9
- };
10
- }
11
- /**
12
- * @summary Add fields by record
13
- * @param original Entity for extend
14
- * @param extender Addition item by key
15
- * @returns Extended entity
16
- */
17
- type ByRecord<TExtensionKey extends TS.Key, TExtensionValue> = Extend.ByRecord.Methods<TExtensionKey, TExtensionValue> & {
18
- /**
19
- * @summary Add fields by record with capitalized keys
20
- * @param original Entity for extend
21
- * @param extender Addition item by key
22
- * @returns Extended entity
23
- */
24
- Capitalized: Extend.ByRecord.Methods<TExtensionKey, TExtensionValue, Capitalize<Extract<TExtensionKey, string>>>;
25
- /**
26
- * @summary Add fields by record with uncapitalized keys
27
- * @param original Entity for extend
28
- * @param extender Addition item by key
29
- * @returns Extended entity
30
- */
31
- Uncapitalized: Extend.ByRecord.Methods<TExtensionKey, TExtensionValue, Uncapitalize<Extract<TExtensionKey, string>>>;
32
- };
33
- /**
34
- * @summary Add arbitrary properties
35
- * @param original Entity for extend
36
- * @param extention properties
37
- * @returns Extended entity
38
- */
39
- type Arbitrary = <TOriginal, TExtension extends object>(original: TOriginal, extention: TExtension | (() => TExtension)) => TOriginal & TExtension;
40
- }
41
- namespace Code {
42
- /**
43
- * @summary `AVStantso.Extend` utility
44
- */
45
- interface Extend {
46
- /**
47
- * @summary Add fields by record
48
- * @param keys Keys for add
49
- * @param getValue Value by key. If empty, "value"="key"
50
- * @param original Entity for extend
51
- * @param extender Addition item by key
52
- * @returns (original, extender) => <Extended_Entity>
53
- */
54
- ByRecord<TExtensionKey extends AVStantso.TS.Key, TExtensionValue = TExtensionKey>(keys: TExtensionKey[] | (() => TExtensionKey[]), getValue?: (key: TExtensionKey) => TExtensionValue): Extend.ByRecord<TExtensionKey, TExtensionValue>;
55
- /**
56
- * @summary Add arbitrary properties
57
- * @param original Entity for extend
58
- * @param extention properties
59
- * @returns Extended entity
60
- */
61
- Arbitrary: Extend.Arbitrary;
62
- }
63
- }
64
- interface Code {
65
- /**
66
- * @summary `AVStantso.Extend` utility
67
- */
68
- Extend: Code.Extend;
69
- }
70
- /**
71
- * @summary Cast object or function for add extended fields
72
- * @param from as TFrom
73
- * @returns from as TTo
74
- */
75
- const Extend: Code.Extend;
76
- }
@@ -1 +0,0 @@
1
- import './_register';
@@ -1,15 +0,0 @@
1
- import './perform';
2
- import './compare';
3
- import './provider';
4
- import './equality';
5
- import './extend';
6
- import './switch';
7
- import './stub';
8
- import './mock';
9
- import './mapping';
10
- import './conveyor';
11
- import './override';
12
- import './transition';
13
- import './value-wrap';
14
- import './async-tasks';
15
- import './classic-enum';