@bigbinary/neeto-commons-frontend 2.0.133 → 2.0.134

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/utils.d.ts CHANGED
@@ -291,4 +291,19 @@ type ChannelNameWithParams = {
291
291
  * );
292
292
  * @endexample
293
293
  */
294
- export function createSubscription(channelName: string | ChannelNameWithParams, callbacks: Mixin): Subscription;
294
+ export function createSubscription(channelName: string | ChannelNameWithParams, callbacks: Mixin): Subscription;
295
+ /**
296
+ *
297
+ * Curried: false
298
+ *
299
+ * This function returns JSON parsed value from localStorage for the given key. The
300
+ *
301
+ * function returns null if the value is not valid JSON.
302
+ *
303
+ * @example
304
+ *
305
+ * localStorage.setItem("key", JSON.stringify({ a: 1 }));
306
+ * getFromLocalStorage("key"); //returns { a: 1 }
307
+ * @endexample
308
+ */
309
+ export function getFromLocalStorage<T extends object>(key: string): T | null;
package/utils.js CHANGED
@@ -2638,6 +2638,13 @@ var debounce = function debounce(func) {
2638
2638
  }, delay);
2639
2639
  };
2640
2640
  };
2641
+ var getFromLocalStorage = function getFromLocalStorage(key) {
2642
+ try {
2643
+ return JSON.parse(localStorage.getItem(key));
2644
+ } catch (_unused) {
2645
+ return null;
2646
+ }
2647
+ };
2641
2648
 
2642
2649
  dayjs.extend(relativeTime);
2643
2650
  dayjs.extend(updateLocale);
@@ -3209,5 +3216,5 @@ var createSubscription = function createSubscription(channelName, callbacks) {
3209
3216
  return subscription;
3210
3217
  };
3211
3218
 
3212
- export { buildUrl, copyToClipboard, createSubscription, dateFormat, debounce, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, joinHyphenCase, resetAuthTokens, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
3219
+ export { buildUrl, copyToClipboard, createSubscription, dateFormat, debounce, getFromLocalStorage, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, joinHyphenCase, resetAuthTokens, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
3213
3220
  //# sourceMappingURL=utils.js.map