dream-common 1.1.14 → 1.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.
Files changed (2) hide show
  1. package/lib/storage.js +7 -45
  2. package/package.json +1 -1
package/lib/storage.js CHANGED
@@ -68,52 +68,14 @@ export const sessionStorageRemove = (key) => {
68
68
  }
69
69
 
70
70
  function getObj(bool = true, value = null) {
71
- if (value === null || value === undefined || value === 'null' || value === 'undefined' || value.length <= 0) {
71
+ if (value === null || value === undefined || value.length <= 0) {
72
72
  return false
73
73
  }
74
- let obj = bool ? {type: typeof value, value: null} : JSON.parse(aesDecrypt(key,value));
75
- switch (typeof value) {
76
- case 'string':
77
- if (bool) {
78
- obj.value = value;
79
- } else if (obj.type === 'array') {
80
- obj = {
81
- type: 'array',
82
- value: obj.value.split("@#&%")
83
- }
84
- } else if (obj.type === 'json') {
85
- obj = {
86
- type: 'json',
87
- value: JSON.parse(obj.value)
88
- }
89
- } else if (obj.type === 'boolean') {
90
- obj = {
91
- type: 'boolean',
92
- value: obj.value === 1
93
- }
94
- }
95
- break;
96
- case 'boolean':
97
- obj.value = value ? 1 : 0;
98
- break;
99
- case 'object':
100
- if (value instanceof Array) {
101
- obj = {
102
- type: 'array',
103
- value: value.join("@#&%")
104
- }
105
- } else if (value instanceof Object) {
106
- obj = {
107
- type: 'json',
108
- value: JSON.stringify(value)
109
- }
110
- }
111
- break;
112
- default:
113
- obj.value = value;
114
- break
74
+ let key = "frzToVa9B1T61brfxXkriolta5PMyrLp";
75
+ if (bool) {
76
+ return aesEncrypt(key,JSON.stringify(value))
77
+ } else {
78
+ const data = aesDecrypt(key,value);
79
+ return JSON.parse(data)
115
80
  }
116
- obj.nonceStr = uuid(true);
117
- obj.timestamp = new Date().getTime();
118
- return bool ? aesEncrypt(key,JSON.stringify(obj)) : obj.value;
119
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dream-common",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {