@etsoo/shared 1.0.80 → 1.0.81
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/__tests__/StorageUtils.ts +1 -0
- package/__tests__/Utils.ts +1 -0
- package/package.json +1 -1
- package/src/StorageUtils.ts +2 -2
|
@@ -8,6 +8,7 @@ test('Tests for all', () => {
|
|
|
8
8
|
StorageUtils.setSessionData('test', { id: 123, name: 'test' });
|
|
9
9
|
|
|
10
10
|
expect(StorageUtils.getSessionData<string>('string')).toBe('test');
|
|
11
|
+
expect(StorageUtils.getSessionData('string1', '')).toBe('');
|
|
11
12
|
expect(StorageUtils.getSessionData('boolean', false)).toBe(true);
|
|
12
13
|
expect(StorageUtils.getSessionData('number', 0)).toBe(3.14);
|
|
13
14
|
expect(StorageUtils.getSessionData('test', {})).toHaveProperty('id', 123);
|
package/__tests__/Utils.ts
CHANGED
|
@@ -101,6 +101,7 @@ test('Tests for objectUpdated', () => {
|
|
|
101
101
|
|
|
102
102
|
test('Tests for parseString', () => {
|
|
103
103
|
expect(Utils.parseString<string>('test')).toBe('test');
|
|
104
|
+
expect(Utils.parseString('test', '')).toBe('test');
|
|
104
105
|
expect(Utils.parseString('true', false)).toBe(true);
|
|
105
106
|
expect(Utils.parseString('', false)).toBeFalsy();
|
|
106
107
|
expect(Utils.parseString<boolean>('')).toBeUndefined();
|
package/package.json
CHANGED
package/src/StorageUtils.ts
CHANGED
|
@@ -57,7 +57,7 @@ export namespace StorageUtils {
|
|
|
57
57
|
const data = localStorage.getItem(key);
|
|
58
58
|
|
|
59
59
|
// Return
|
|
60
|
-
return Utils.parseString(data, defaultValue);
|
|
60
|
+
return Utils.parseString<T, M>(data, defaultValue);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -83,7 +83,7 @@ export namespace StorageUtils {
|
|
|
83
83
|
const data = sessionStorage.getItem(key);
|
|
84
84
|
|
|
85
85
|
// Return
|
|
86
|
-
return Utils.parseString(data, defaultValue);
|
|
86
|
+
return Utils.parseString<T, M>(data, defaultValue);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|