sliftutils 0.30.0 → 0.32.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/.cursorrules CHANGED
@@ -26,18 +26,6 @@ We use MobX for state management. Components should use a variable called synced
26
26
 
27
27
  The code automatically updates on save, so do not ever run commands to rerun the site.
28
28
 
29
- In the implementation for every type of API, there should be a companion file to manage the session (ex smsSession.ts). This should export a function which makes calling the API functions simple by automatically managing the session. Because the session helper will be making the function calls, it can try catch them and appropriately handle the session errors that require regenerating the session. Of course, if it's not a session error, it should just rethrow it.
30
-
31
- Use createPersistentObject for persistent things like session states. It's accessed synchronously and the key will have an undefined value if it the value isn't set.
32
-
33
- let persistent = createPersistentObject<{
34
- token: string;
35
- }>("sms");
36
-
37
- persistent.token = "...";
38
- persistent.token;
39
-
40
-
41
29
  Coding Styles
42
30
  Try not to use "null", and instead always use "undefined".
43
31
 
@@ -87,6 +75,8 @@ Coding Styles
87
75
 
88
76
  DO NOT redeclare types. JUST IMPORT THEM!
89
77
 
78
+ Do not try catch for no reason. If you can't actually handle the exception, just let it throw.
79
+
90
80
 
91
81
  General Styling
92
82
  Never use em or rem. Only use px or vw/vh/%.
package/index.d.ts CHANGED
@@ -37,11 +37,6 @@ declare module "sliftutils/misc/matchFilter" {
37
37
 
38
38
  }
39
39
 
40
- declare module "sliftutils/misc/promise" {
41
- export declare function promiseToWarning<T>(promise: Promise<T>): Promise<T | undefined>;
42
-
43
- }
44
-
45
40
  declare module "sliftutils/misc/random" {
46
41
  export declare function getSeededRandom(seed: number): () => number;
47
42
  export declare function shuffle<T>(array: T[], seed: number): T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
package/misc/promise.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function promiseToWarning<T>(promise: Promise<T>): Promise<T | undefined>;
package/misc/promise.ts DELETED
@@ -1,6 +0,0 @@
1
- export function promiseToWarning<T>(promise: Promise<T>): Promise<T | undefined> {
2
- return promise.catch(error => {
3
- console.warn("Promise rejected", error);
4
- return undefined;
5
- });
6
- }