@putkoff/abstract-utilities 0.1.173 → 0.1.175
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/dist/cjs/index.js +49 -50
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +49 -51
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/fetch_utils/src/fetchIt_utils.d.ts +4 -0
- package/dist/functions/safe_utils/src/safe_globals.d.ts +3 -5
- package/dist/functions/safe_utils/src/safe_storage.d.ts +3 -7
- package/package.json +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Safely walk `
|
|
3
|
-
*
|
|
4
|
-
* @param rootName "window" or "document"
|
|
5
|
-
* @param path sequence of property names, e.g. ["location","host"] or ["baseURI"]
|
|
2
|
+
* Safely walk `globalThis` (or window/document) by a chain of property names.
|
|
3
|
+
* Returns `undefined` if any step is missing.
|
|
6
4
|
*/
|
|
7
|
-
export declare function safeGlobalProp<
|
|
5
|
+
export declare function safeGlobalProp<T = any>(...path: string[]): T | undefined;
|
|
@@ -11,11 +11,7 @@ export declare function getSafeLocalStorage(): Storage | undefined;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function callStorage<K extends keyof Storage>(method: K, ...args: Parameters<Storage[K]>): ReturnType<Storage[K]> | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* Safely call localStorage
|
|
15
|
-
*
|
|
16
|
-
* @param storageName "localStorage" or "sessionStorage"
|
|
17
|
-
* @param method one of the Storage methods, e.g. "getItem", "setItem", etc.
|
|
18
|
-
* @param args arguments to pass along (e.g. key, value)
|
|
19
|
-
* @returns whatever the underlying method returns, or undefined if unavailable/fails
|
|
14
|
+
* Safely call storage methods (`localStorage` or `sessionStorage`) without blowing up.
|
|
15
|
+
* Returns `undefined` on any error.
|
|
20
16
|
*/
|
|
21
|
-
export declare function safeStorage<S extends "localStorage" | "sessionStorage",
|
|
17
|
+
export declare function safeStorage<S extends "localStorage" | "sessionStorage", K extends keyof Storage>(storageName: S, method: K, ...args: Parameters<Storage[K]>): ReturnType<Storage[K]> | undefined;
|