@less-is-more/less-js 1.4.28-1 → 1.4.28-3

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/package.json +1 -1
  2. package/src/cache.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@less-is-more/less-js",
3
- "version": "1.4.28-1",
3
+ "version": "1.4.28-3",
4
4
  "description": "Fast develop kit for nodejs",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/cache.js CHANGED
@@ -59,7 +59,7 @@ module.exports = class Cache {
59
59
  "setex",
60
60
  fullKey,
61
61
  timeSecond + "",
62
- zip ? await Cache._zip(JSON.stringify(result)) : JSON.stringify(result)
62
+ zip ? Cache._zip(JSON.stringify(result)) : JSON.stringify(result)
63
63
  );
64
64
  }
65
65
  } else {
@@ -67,7 +67,7 @@ module.exports = class Cache {
67
67
  "setex",
68
68
  fullKey,
69
69
  timeSecond + "",
70
- zip ? await Cache._zip(result.toString()) : result.toString()
70
+ zip ? Cache._zip(result.toString()) : result.toString()
71
71
  );
72
72
  }
73
73
  return result;
@@ -75,7 +75,7 @@ module.exports = class Cache {
75
75
  } else {
76
76
  console.log("Found cache", fullKey);
77
77
  if (zip) {
78
- savedData = await Cache._unzip(savedData);
78
+ savedData = Cache._unzip(savedData);
79
79
  }
80
80
  // 优先转成json
81
81
  if (savedData.startsWith("{") || savedData.startsWith("[")) {
@@ -86,12 +86,12 @@ module.exports = class Cache {
86
86
  }
87
87
  }
88
88
 
89
- static async _zip(text) {
89
+ static _zip(text) {
90
90
  const zipData = zlib.deflateSync(text).toString("base64");
91
91
  return zipData;
92
92
  }
93
93
 
94
- static async _unzip(base64) {
94
+ static _unzip(base64) {
95
95
  const buffer = Buffer.from(base64, "base64");
96
96
  const text = zlib.inflateSync(buffer).toString();
97
97
  return text;