@bigbinary/neeto-commons-frontend 2.1.13 → 2.1.15
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 +1 -0
- package/package.json +1 -1
- package/react-utils.cjs.js +8 -3
- package/react-utils.cjs.js.map +1 -1
- package/react-utils.d.ts +3 -1
- package/react-utils.js +8 -3
- package/react-utils.js.map +1 -1
- package/utils.cjs.js +4 -0
- package/utils.cjs.js.map +1 -1
- package/utils.d.ts +15 -1
- package/utils.js +5 -2
- package/utils.js.map +1 -1
package/utils.d.ts
CHANGED
|
@@ -407,4 +407,18 @@ export function createSubscription(channelName: string | ChannelNameWithParams,
|
|
|
407
407
|
* getFromLocalStorage("key"); //returns { a: 1 }
|
|
408
408
|
* @endexample
|
|
409
409
|
*/
|
|
410
|
-
export function getFromLocalStorage<T extends object>(key: string): T | null;
|
|
410
|
+
export function getFromLocalStorage<T extends object>(key: string): T | null;
|
|
411
|
+
/**
|
|
412
|
+
*
|
|
413
|
+
* The setToLocalStorage function takes a key and a value as its parameters
|
|
414
|
+
*
|
|
415
|
+
* and save the stringified representation of the value under the specified key
|
|
416
|
+
*
|
|
417
|
+
* within local storage.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
*
|
|
421
|
+
* setToLocalStorage("token", "1234-5678-9101-1213");
|
|
422
|
+
* @endexample
|
|
423
|
+
*/
|
|
424
|
+
export function setToLocalStorage(key: string, value: any): void;
|
package/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { values, curry, toPairs, pipe, omit, isEmpty } from 'ramda';
|
|
2
|
+
import { values, curry, toPairs, pipe, omit, isEmpty, isNotNil } from 'ramda';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
import { getRandomInt, preprocessForSerialization } from '@bigbinary/neeto-commons-frontend/pure';
|
|
5
5
|
import { Toastr } from '@bigbinary/neetoui';
|
|
@@ -2645,6 +2645,9 @@ var getFromLocalStorage = function getFromLocalStorage(key) {
|
|
|
2645
2645
|
return null;
|
|
2646
2646
|
}
|
|
2647
2647
|
};
|
|
2648
|
+
var setToLocalStorage = function setToLocalStorage(key, value) {
|
|
2649
|
+
if (isNotNil(value)) localStorage.setItem(key, JSON.stringify(value));else localStorage.removeItem(key);
|
|
2650
|
+
};
|
|
2648
2651
|
|
|
2649
2652
|
dayjs.extend(relativeTime);
|
|
2650
2653
|
dayjs.extend(updateLocale);
|
|
@@ -3222,5 +3225,5 @@ var createSubscription = function createSubscription(channelName, callbacks) {
|
|
|
3222
3225
|
return subscription;
|
|
3223
3226
|
};
|
|
3224
3227
|
|
|
3225
|
-
export { buildUrl, copyToClipboard, createSubscription, dateFormat, debounce, getFromLocalStorage, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, joinHyphenCase, resetAuthTokens, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
|
|
3228
|
+
export { buildUrl, copyToClipboard, createSubscription, dateFormat, debounce, getFromLocalStorage, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, joinHyphenCase, resetAuthTokens, setToLocalStorage, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
|
|
3226
3229
|
//# sourceMappingURL=utils.js.map
|