use-good-hooks 1.0.0 → 1.0.2

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 CHANGED
@@ -340,4 +340,3 @@ MIT © [Felipe Rohde](mailto:feliperohdee@gmail.com)
340
340
  - Twitter: [@felipe_rohde](https://twitter.com/felipe_rohde)
341
341
  - Github: [@feliperohdee](https://github.com/feliperohdee)
342
342
  - Email: feliperohdee@gmail.com
343
-
@@ -0,0 +1,56 @@
1
+ declare type SetUrlStateAction<T> = T | ((prevState: T) => T);
2
+
3
+ declare type StorageType = 'local' | 'session';
4
+
5
+ declare type StrictObject = {
6
+ [key: string]: any;
7
+ } & {
8
+ length?: never;
9
+ };
10
+
11
+ export declare const useDebounce: <T>(value: T, delay?: number) => T;
12
+
13
+ export declare const useDistinct: <T>(inputValue: T, options?: UseDistinctOptions) => UseDistinctReturn<T>;
14
+
15
+ declare type UseDistinctOptions = {
16
+ compare?: (a: any, b: any) => boolean;
17
+ debounce?: number;
18
+ deep?: boolean;
19
+ };
20
+
21
+ declare type UseDistinctReturn<T> = {
22
+ distinct: boolean;
23
+ prevValue: T | undefined;
24
+ value: T;
25
+ };
26
+
27
+ export declare const usePrev: <T>(value: T) => T | undefined;
28
+
29
+ export declare const useStorageState: <T extends StrictObject>(key: string, initialState: T, options?: UseStorageStateOptions) => [T, (value: T | ((prev: T) => T)) => void, {
30
+ removeKey: () => void;
31
+ }];
32
+
33
+ declare type UseStorageStateOptions = {
34
+ debounce?: number;
35
+ onError?: (err: Error) => void;
36
+ omitKeys?: string[] | ((value: any, key: string) => boolean);
37
+ pickKeys?: string[] | ((value: any, key: string) => boolean);
38
+ storage?: StorageType;
39
+ };
40
+
41
+ export declare const useThrottle: <T>(value: T, delay?: number) => T;
42
+
43
+ export declare const useUrlState: <T extends StrictObject>(initialState: T, options: UseUrlStateOptions) => [T, (value: SetUrlStateAction<T>) => void];
44
+
45
+ declare type UseUrlStateOptions = {
46
+ debounce?: number;
47
+ kebabCase?: boolean;
48
+ omitKeys?: string[] | ((value: any, key: string) => boolean);
49
+ omitValues?: any[] | ((value: any, key: string) => boolean);
50
+ onError?: (err: Error) => void;
51
+ pickKeys?: string[] | ((value: any, key: string) => boolean);
52
+ prefix?: string;
53
+ url: URL;
54
+ };
55
+
56
+ export { }