tools-min-ns 1.17.1 → 1.18.0

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 CHANGED
@@ -5,6 +5,9 @@ pnpm i tools-min-ns --save
5
5
  ```
6
6
 
7
7
  # updates
8
+ ## v1.18.0
9
+ >StorageUtil
10
+ 采用xor压缩算法加解密
8
11
  ## v1.17.1
9
12
  >StorageUtil
10
13
  PasswordUtil引用路径bug
@@ -26,14 +26,14 @@ var StorageUtil;
26
26
  (function (StorageUtil) {
27
27
  function setItem(name, data, opts) {
28
28
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config.cacheType;
29
- if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name), PasswordUtil.strEncrypt(JSON.stringify(data)));
29
+ if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name), PasswordUtil.xorEncryptData(data));
30
30
  }
31
31
  StorageUtil.setItem = setItem;
32
32
  function getItem(name, opts) {
33
33
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config.cacheType;
34
34
  var item = window["".concat(cacheType, "Storage")].getItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config.title).concat(name));
35
35
  try {
36
- return JSON.parse(PasswordUtil.strDecrypt(item));
36
+ return PasswordUtil.xorDecryptData(item);
37
37
  } catch (error) {
38
38
  return item;
39
39
  }
@@ -36,14 +36,14 @@ var StorageUtil;
36
36
  (function (StorageUtil) {
37
37
  function setItem(name, data, opts) {
38
38
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config_1.default.cacheType;
39
- if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name), PasswordUtil_1.default.strEncrypt(JSON.stringify(data)));
39
+ if (name && data !== undefined) window["".concat(cacheType, "Storage")].setItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name), PasswordUtil_1.default.xorEncryptData(data));
40
40
  }
41
41
  StorageUtil.setItem = setItem;
42
42
  function getItem(name, opts) {
43
43
  var cacheType = (opts === null || opts === void 0 ? void 0 : opts.type) || config_1.default.cacheType;
44
44
  var item = window["".concat(cacheType, "Storage")].getItem((opts === null || opts === void 0 ? void 0 : opts.itemName) || "".concat(config_1.default.title).concat(name));
45
45
  try {
46
- return JSON.parse(PasswordUtil_1.default.strDecrypt(item));
46
+ return PasswordUtil_1.default.xorDecryptData(item);
47
47
  } catch (error) {
48
48
  return item;
49
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tools-min-ns",
3
3
  "description": "工具包适用于前端以及node",
4
- "version": "1.17.1",
4
+ "version": "1.18.0",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
7
7
  "author": "nanshen",