@formvk/shared 0.0.0-stage → 0.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.
@@ -0,0 +1,181 @@
1
+ import { Path as FormPath } from '@formvk/path';
2
+ import { Pattern as FormPathPattern } from '@formvk/path';
3
+
4
+ export declare function applyMiddleware(payload: any, fns?: IMiddleware[]): Promise<unknown>;
5
+
6
+ export declare function clone<T>(values: T): T;
7
+
8
+ declare function deepmerge(target: any, source: any, options?: Options): any;
9
+
10
+ /**
11
+ *
12
+ * @param defaults
13
+ * @param targets
14
+ */
15
+ export declare function defaults(defaults_: any, targets: any): any;
16
+
17
+ export declare function deprecate<P1 = any, P2 = any, P3 = any, P4 = any, P5 = any>(method: any, message?: string, help?: string): ((this: any, p1?: P1, p2?: P2, p3?: P3, p4?: P4, p5?: P5) => any) | undefined;
18
+
19
+ export declare function each(val: string, iterator: EachStringIterator, revert?: boolean): void;
20
+
21
+ export declare function each<T>(val: T[], iterator: EachArrayIterator<T>, revert?: boolean): void;
22
+
23
+ export declare function each<T extends object, TValue extends T[keyof T]>(val: T, iterator: EachObjectIterator<TValue>, revert?: boolean): void;
24
+
25
+ declare type EachArrayIterator<T> = (currentValue: T, key: number) => void | boolean;
26
+
27
+ declare type EachObjectIterator<T = any> = (currentValue: T, key: string) => void | boolean;
28
+
29
+ declare type EachStringIterator = (currentValue: string, key: number) => void | boolean;
30
+
31
+ export declare function every<T extends string>(val: T, iterator: EachStringIterator, revert?: boolean): boolean;
32
+
33
+ export declare function every<T>(val: T[], iterator: EachArrayIterator<T>, revert?: boolean): boolean;
34
+
35
+ export declare function every<T extends object>(val: T, iterator: EachObjectIterator, revert?: boolean): boolean;
36
+
37
+ export declare function find<T extends string>(val: T, iterator: EachStringIterator, revert?: boolean): any;
38
+
39
+ export declare function find<T>(val: T[], iterator: EachArrayIterator<T>, revert?: boolean): T;
40
+
41
+ export declare function find<T extends object>(val: T, iterator: EachObjectIterator, revert?: boolean): T[keyof T];
42
+
43
+ export declare function findIndex<T extends string>(val: T, iterator: EachStringIterator, revert?: boolean): number;
44
+
45
+ export declare function findIndex<T>(val: T[], iterator: EachArrayIterator<T>, revert?: boolean): number;
46
+
47
+ export declare function findIndex<T extends object>(val: T, iterator: EachObjectIterator, revert?: boolean): keyof T;
48
+
49
+ export { FormPath }
50
+
51
+ export { FormPathPattern }
52
+
53
+ export declare function getType(obj: any): string;
54
+
55
+ export declare const globalThisPolyfill: Window;
56
+
57
+ export declare interface IMiddleware<Payload = any, Result = any> {
58
+ (payload: Payload, next: (payload?: Payload) => Result): Result;
59
+ }
60
+
61
+ export declare function includes<T extends string>(val: T, searchElement: string, revert?: boolean): boolean;
62
+
63
+ export declare function includes<T>(val: T[], searchElement: T, revert?: boolean): boolean;
64
+
65
+ export declare function instOf<K extends keyof typeof window & string & {}, R = K extends keyof typeof window ? InstanceType<(typeof window)[K]> : unknown>(value: any, cls: K): value is R;
66
+
67
+ export declare const isArr: (arg: any) => arg is any[];
68
+
69
+ export declare const isBool: (obj: unknown) => obj is boolean;
70
+
71
+ export declare function isEmpty<T>(val: T, strict?: boolean): boolean;
72
+
73
+ export declare const isEqual: (a: any, b: any) => any;
74
+
75
+ export declare function isFn(val: any): val is Function;
76
+
77
+ export declare function isHTMLElement(target: any): target is EventTarget;
78
+
79
+ export declare function isMap(val: any): val is Map<any, any>;
80
+
81
+ export declare const isNum: (obj: unknown) => obj is number;
82
+
83
+ export declare function isNumberLike(index: any): index is number;
84
+
85
+ export declare function isObj(val: unknown): val is object;
86
+
87
+ export declare const isPlainObj: (obj: unknown) => obj is object;
88
+
89
+ export declare function isReactElement(obj: any): boolean;
90
+
91
+ export declare const isRegExp: (obj: unknown) => obj is RegExp;
92
+
93
+ export declare function isSet(val: any): val is Set<any>;
94
+
95
+ export declare const isStr: (obj: unknown) => obj is string;
96
+
97
+ export declare function isUndef<T>(val: T): val is T extends undefined ? T : never;
98
+
99
+ export declare function isValid<T>(val: T): val is T extends undefined ? never : T extends null ? never : T;
100
+
101
+ export declare function isWeakMap(val: any): val is WeakMap<any, any>;
102
+
103
+ export declare function isWeakSet(val: any): val is WeakSet<any>;
104
+
105
+ export declare function lazyMerge<T extends object | Function>(target: T, ...args: T[]): any;
106
+
107
+ export declare function lowerCase(input: string): string;
108
+
109
+ export declare function map<T>(val: string, iterator: MapStringIterator<T>, revert?: boolean): T[];
110
+
111
+ export declare function map<TItem, TResult>(val: TItem[], iterator: MapArrayIterator<TItem, TResult>, revert?: boolean): TResult[];
112
+
113
+ export declare function map<T extends object, TResult>(val: T, iterator: MapObjectIterator<T[keyof T], TResult>, revert?: boolean): Record<keyof T, TResult>;
114
+
115
+ declare type MapArrayIterator<TItem, TResult> = (currentValue: TItem, key: number) => TResult;
116
+
117
+ declare type MapObjectIterator<TItem, TResult> = (currentValue: TItem, key: string) => TResult;
118
+
119
+ declare type MapStringIterator<TResult> = (currentValue: string, key: number) => TResult;
120
+
121
+ declare type MemoArrayIterator<T, U> = (previousValue: U, currentValue: T, key: number) => U;
122
+
123
+ declare type MemoObjectIterator<TValue, TResult> = (previousValue: TResult, currentValue: TValue, key: string) => TResult;
124
+
125
+ declare type MemoStringIterator<T> = (previousValue: T, currentValue: string, key: number) => T;
126
+
127
+ export declare const merge: typeof deepmerge;
128
+
129
+ export declare function move<T>(array: T[], fromIndex: number, toIndex: number): T[];
130
+
131
+ declare interface Options {
132
+ arrayMerge?(target: any[], source: any[], options?: Options): any[];
133
+ clone?: boolean;
134
+ assign?: boolean;
135
+ customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
136
+ isMergeableObject?(value: object): boolean;
137
+ cloneUnlessOtherwiseSpecified?: (value: any, options: Options) => any;
138
+ }
139
+
140
+ /** 'validate-error' -> 'ValidateError' */
141
+ export declare function pascalCase(input: string): string;
142
+
143
+ export declare function reduce<T, U>(val: T[], iterator: MemoArrayIterator<T, U>, accumulator?: U, revert?: boolean): U;
144
+
145
+ export declare function reduce<T>(val: string, iterator: MemoStringIterator<T>, accumulator?: T, revert?: boolean): T;
146
+
147
+ export declare function reduce<T extends object, TValue extends T[keyof T], TResult = any>(val: T, iterator: MemoObjectIterator<TValue, TResult>, accumulator?: TResult, revert?: boolean): TResult;
148
+
149
+ export declare function shallowClone(values: any): any;
150
+
151
+ export declare function some<T extends string>(val: T, iterator: EachStringIterator, revert?: boolean): boolean;
152
+
153
+ export declare function some<T>(val: T[], iterator: EachArrayIterator<T>, revert?: boolean): boolean;
154
+
155
+ export declare function some<T extends object>(val: T, iterator: EachObjectIterator, revert?: boolean): boolean;
156
+
157
+ export declare function stringLength(input: string): any;
158
+
159
+ export declare class Subscribable<Payload = any> {
160
+ subscribers: {
161
+ index: number;
162
+ [key: number]: Subscriber<Payload>;
163
+ };
164
+ subscription: Subscription<Payload>;
165
+ subscribe: (callback?: Subscriber<Payload>) => number | undefined;
166
+ unsubscribe: (index?: number) => void;
167
+ notify: (payload: Payload, silent?: boolean) => void;
168
+ }
169
+
170
+ export declare type Subscriber<S> = (payload: S) => void;
171
+
172
+ export declare interface Subscription<S> {
173
+ notify?: (payload: S) => void | boolean;
174
+ filter?: (payload: S) => any;
175
+ }
176
+
177
+ export declare function toArr<T extends any, R = T extends (infer P)[] ? P[] : T extends any[] ? T : any[]>(val: T): R;
178
+
179
+ export declare function uid(len?: number): string;
180
+
181
+ export { }