sliftutils 1.0.0 → 1.0.1

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/.cursorrules CHANGED
@@ -29,6 +29,10 @@ The code automatically updates on save, so do not ever run commands to rerun the
29
29
  Use tool calls to read files and directories where possible, instead of running "ls", "dir", etc.
30
30
 
31
31
  Coding Styles
32
+ Don't make functions that will never be reused and are short. This just makes the code too confusing. If the function is under five lines and it's not being reused, you shouldn't create it, unless instructed explicitly to create it.
33
+
34
+ Comments should be used sparingly and only if it's required to explain what's being done. If you're calling a function called create imageName and the comment is called create imageName, you will be fired because that's just stupid. It's a waste of lines.
35
+
32
36
  Comments go in the line before, never after the semicolon.
33
37
 
34
38
  Try not to use "null", and instead always use "undefined".
package/misc/apiKeys.tsx CHANGED
@@ -99,11 +99,20 @@ let getStorage = lazy((): {
99
99
  });
100
100
 
101
101
  export const getAPIKey = cache(async function getAPIKey(key: string): Promise<string> {
102
+ let innerKey = "key";
103
+ if (isNode()) {
104
+ if (key.includes(".json.")) {
105
+ let [baseKey, innerKeyPart] = key.split(".json.");
106
+ baseKey += ".json";
107
+ innerKey = innerKeyPart;
108
+ key = baseKey;
109
+ }
110
+ }
102
111
  let keyKey = getStorageKey(key);
103
112
  let localStorageValue = getStorage().getItem(keyKey);
104
113
  if (localStorageValue?.startsWith("{")) {
105
114
  try {
106
- localStorageValue = JSON.parse(localStorageValue).key;
115
+ localStorageValue = JSON.parse(localStorageValue)[innerKey];
107
116
  } catch { }
108
117
  }
109
118
  if (localStorageValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [