@choksheak/ts-utils 0.1.3 → 0.1.4
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/dist/assert.d.ts +5 -0
- package/dist/assert.js +1 -0
- package/dist/assert.js.map +1 -1
- package/dist/localStorageCache.d.ts +9 -0
- package/dist/localStorageCache.js +1 -0
- package/dist/localStorageCache.js.map +1 -1
- package/dist/localStorageCache.test.d.ts +1 -0
- package/dist/localStorageCache.test.js +2 -0
- package/dist/localStorageCache.test.js.map +1 -1
- package/dist/nonNil.d.ts +5 -0
- package/dist/nonNil.js +1 -0
- package/dist/nonNil.js.map +1 -1
- package/dist/safeParseInt.d.ts +4 -0
- package/dist/safeParseInt.js +1 -0
- package/dist/safeParseInt.js.map +1 -1
- package/package.json +4 -2
package/dist/assert.d.ts
ADDED
package/dist/assert.js
CHANGED
package/dist/assert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Type asserts that `t` is truthy. Throws an error with `errorMessage` if\n * `t` is falsy.\n */\nexport function assert<T>(\n t: T | null | undefined | \"\" | 0 | -0 | 0n | false | typeof NaN,\n errorMessage: string,\n): asserts t is T {\n if (!t) {\n throw new Error(errorMessage);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/assert.ts"],"sourcesContent":["/**\n * Type asserts that `t` is truthy. Throws an error with `errorMessage` if\n * `t` is falsy.\n */\nexport function assert<T>(\n t: T | null | undefined | \"\" | 0 | -0 | 0n | false | typeof NaN,\n errorMessage: string,\n): asserts t is T {\n if (!t) {\n throw new Error(errorMessage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,OACd,GACA,cACgB;AAChB,MAAI,CAAC,GAAG;AACN,UAAM,IAAI,MAAM,YAAY;AAAA,EAC9B;AACF;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple local storage cache with support for auto-expiration.
|
|
3
|
+
* Note that this works in the browser context only because nodejs does not
|
|
4
|
+
* have local storage.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LocalStorageCache {
|
|
7
|
+
static setValue<T>(key: string, value: T, expireDeltaMs: number): void;
|
|
8
|
+
static getValue<T>(key: string, logError?: boolean): T | undefined;
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/localStorageCache.ts"],"sourcesContent":["/**\n * Simple local storage cache with support for auto-expiration.\n * Note that this works in the browser context only because nodejs does not\n * have local storage.\n */\nexport class LocalStorageCache {\n public static setValue<T>(key: string, value: T, expireDeltaMs: number) {\n const expireMs = Date.now() + expireDeltaMs;\n const valueStr = JSON.stringify({ value, expireMs });\n\n globalThis.localStorage.setItem(key, valueStr);\n }\n\n public static getValue<T>(key: string, logError = true): T | undefined {\n const jsonStr = globalThis.localStorage.getItem(key);\n if (!jsonStr) return undefined;\n\n try {\n const obj: { value: T; expireMs: number } | undefined =\n JSON.parse(jsonStr);\n if (\n !obj ||\n typeof obj !== \"object\" ||\n !(\"value\" in obj) ||\n !(\"expireMs\" in obj)\n ) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n if (Date.now() >= obj.expireMs) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n return obj.value;\n } catch (e) {\n if (logError) {\n console.error(`Found invalid storage value: ${key}=${jsonStr}:`, e);\n }\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/localStorageCache.ts"],"sourcesContent":["/**\n * Simple local storage cache with support for auto-expiration.\n * Note that this works in the browser context only because nodejs does not\n * have local storage.\n */\nexport class LocalStorageCache {\n public static setValue<T>(key: string, value: T, expireDeltaMs: number) {\n const expireMs = Date.now() + expireDeltaMs;\n const valueStr = JSON.stringify({ value, expireMs });\n\n globalThis.localStorage.setItem(key, valueStr);\n }\n\n public static getValue<T>(key: string, logError = true): T | undefined {\n const jsonStr = globalThis.localStorage.getItem(key);\n if (!jsonStr) return undefined;\n\n try {\n const obj: { value: T; expireMs: number } | undefined =\n JSON.parse(jsonStr);\n if (\n !obj ||\n typeof obj !== \"object\" ||\n !(\"value\" in obj) ||\n !(\"expireMs\" in obj)\n ) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n if (Date.now() >= obj.expireMs) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n return obj.value;\n } catch (e) {\n if (logError) {\n console.error(`Found invalid storage value: ${key}=${jsonStr}:`, e);\n }\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,oBAAN,MAAwB;AAAA,EAC7B,OAAc,SAAY,KAAa,OAAU,eAAuB;AACtE,UAAM,WAAW,KAAK,IAAI,IAAI;AAC9B,UAAM,WAAW,KAAK,UAAU,EAAE,OAAO,SAAS,CAAC;AAEnD,eAAW,aAAa,QAAQ,KAAK,QAAQ;AAAA,EAC/C;AAAA,EAEA,OAAc,SAAY,KAAa,WAAW,MAAqB;AACrE,UAAM,UAAU,WAAW,aAAa,QAAQ,GAAG;AACnD,QAAI,CAAC,QAAS,QAAO;AAErB,QAAI;AACF,YAAM,MACJ,KAAK,MAAM,OAAO;AACpB,UACE,CAAC,OACD,OAAO,QAAQ,YACf,EAAE,WAAW,QACb,EAAE,cAAc,MAChB;AACA,mBAAW,aAAa,WAAW,GAAG;AACtC,eAAO;AAAA,MACT;AAEA,UAAI,KAAK,IAAI,KAAK,IAAI,UAAU;AAC9B,mBAAW,aAAa,WAAW,GAAG;AACtC,eAAO;AAAA,MACT;AAEA,aAAO,IAAI;AAAA,IACb,SAAS,GAAG;AACV,UAAI,UAAU;AACZ,gBAAQ,MAAM,gCAAgC,GAAG,IAAI,OAAO,KAAK,CAAC;AAAA,MACpE;AACA,iBAAW,aAAa,WAAW,GAAG;AACtC,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/localStorageCache.ts","../src/localStorageCache.test.ts"],"sourcesContent":["/**\n * Simple local storage cache with support for auto-expiration.\n * Note that this works in the browser context only because nodejs does not\n * have local storage.\n */\nexport class LocalStorageCache {\n public static setValue<T>(key: string, value: T, expireDeltaMs: number) {\n const expireMs = Date.now() + expireDeltaMs;\n const valueStr = JSON.stringify({ value, expireMs });\n\n globalThis.localStorage.setItem(key, valueStr);\n }\n\n public static getValue<T>(key: string, logError = true): T | undefined {\n const jsonStr = globalThis.localStorage.getItem(key);\n if (!jsonStr) return undefined;\n\n try {\n const obj: { value: T; expireMs: number } | undefined =\n JSON.parse(jsonStr);\n if (\n !obj ||\n typeof obj !== \"object\" ||\n !(\"value\" in obj) ||\n !(\"expireMs\" in obj)\n ) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n if (Date.now() >= obj.expireMs) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n return obj.value;\n } catch (e) {\n if (logError) {\n console.error(`Found invalid storage value: ${key}=${jsonStr}:`, e);\n }\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n }\n}\n","import { LocalStorageCache } from \"./localStorageCache\";\n\ndescribe(\"LocalStorageCache\", () => {\n beforeEach(() => {\n // Clear localStorage before each test\n global.localStorage.clear();\n jest.useFakeTimers(); // Use fake timers to control Date.now\n });\n\n afterEach(() => {\n jest.useRealTimers(); // Restore real timers after each test\n });\n\n describe(\"setValue\", () => {\n it(\"should store a value with an expiration time\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n const storedValue = JSON.parse(\n global.localStorage.getItem(key) as string,\n );\n expect(storedValue.value).toBe(value);\n expect(typeof storedValue.expireMs).toBe(\"number\");\n });\n });\n\n describe(\"getValue\", () => {\n it(\"should retrieve a stored value if not expired\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n expect(LocalStorageCache.getValue(key)).toBe(value);\n });\n\n it(\"should return undefined if the value has expired\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n // Advance time by 2 seconds to ensure expiration\n jest.advanceTimersByTime(2000);\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n });\n\n it(\"should return undefined if the key does not exist\", () => {\n expect(LocalStorageCache.getValue(\"nonexistentKey\")).toBeUndefined();\n });\n\n it(\"should return undefined if the stored data is invalid and remove it from storage\", () => {\n const consoleError = jest.spyOn(console, \"error\").mockReturnValue();\n\n const key = \"testKey\";\n // Set an invalid JSON format in localStorage\n global.localStorage.setItem(key, \"invalidJSON\");\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n expect(consoleError).toHaveBeenCalledTimes(1);\n expect(consoleError.mock.calls[0][0]).toBe(\n \"Found invalid storage value: testKey=invalidJSON:\",\n );\n });\n\n it(\"should return undefined if stored data is missing required fields and remove it from storage\", () => {\n const key = \"testKey\";\n // Set JSON with missing fields\n global.localStorage.setItem(\n key,\n JSON.stringify({ someOtherField: \"data\" }),\n );\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n });\n });\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/localStorageCache.ts","../src/localStorageCache.test.ts"],"sourcesContent":["/**\n * Simple local storage cache with support for auto-expiration.\n * Note that this works in the browser context only because nodejs does not\n * have local storage.\n */\nexport class LocalStorageCache {\n public static setValue<T>(key: string, value: T, expireDeltaMs: number) {\n const expireMs = Date.now() + expireDeltaMs;\n const valueStr = JSON.stringify({ value, expireMs });\n\n globalThis.localStorage.setItem(key, valueStr);\n }\n\n public static getValue<T>(key: string, logError = true): T | undefined {\n const jsonStr = globalThis.localStorage.getItem(key);\n if (!jsonStr) return undefined;\n\n try {\n const obj: { value: T; expireMs: number } | undefined =\n JSON.parse(jsonStr);\n if (\n !obj ||\n typeof obj !== \"object\" ||\n !(\"value\" in obj) ||\n !(\"expireMs\" in obj)\n ) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n if (Date.now() >= obj.expireMs) {\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n\n return obj.value;\n } catch (e) {\n if (logError) {\n console.error(`Found invalid storage value: ${key}=${jsonStr}:`, e);\n }\n globalThis.localStorage.removeItem(key);\n return undefined;\n }\n }\n}\n","import { LocalStorageCache } from \"./localStorageCache\";\n\ndescribe(\"LocalStorageCache\", () => {\n beforeEach(() => {\n // Clear localStorage before each test\n global.localStorage.clear();\n jest.useFakeTimers(); // Use fake timers to control Date.now\n });\n\n afterEach(() => {\n jest.useRealTimers(); // Restore real timers after each test\n });\n\n describe(\"setValue\", () => {\n it(\"should store a value with an expiration time\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n const storedValue = JSON.parse(\n global.localStorage.getItem(key) as string,\n );\n expect(storedValue.value).toBe(value);\n expect(typeof storedValue.expireMs).toBe(\"number\");\n });\n });\n\n describe(\"getValue\", () => {\n it(\"should retrieve a stored value if not expired\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n expect(LocalStorageCache.getValue(key)).toBe(value);\n });\n\n it(\"should return undefined if the value has expired\", () => {\n const key = \"testKey\";\n const value = \"testValue\";\n const expireDeltaMs = 1000; // 1 second\n\n LocalStorageCache.setValue(key, value, expireDeltaMs);\n\n // Advance time by 2 seconds to ensure expiration\n jest.advanceTimersByTime(2000);\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n });\n\n it(\"should return undefined if the key does not exist\", () => {\n expect(LocalStorageCache.getValue(\"nonexistentKey\")).toBeUndefined();\n });\n\n it(\"should return undefined if the stored data is invalid and remove it from storage\", () => {\n const consoleError = jest.spyOn(console, \"error\").mockReturnValue();\n\n const key = \"testKey\";\n // Set an invalid JSON format in localStorage\n global.localStorage.setItem(key, \"invalidJSON\");\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n expect(consoleError).toHaveBeenCalledTimes(1);\n expect(consoleError.mock.calls[0][0]).toBe(\n \"Found invalid storage value: testKey=invalidJSON:\",\n );\n });\n\n it(\"should return undefined if stored data is missing required fields and remove it from storage\", () => {\n const key = \"testKey\";\n // Set JSON with missing fields\n global.localStorage.setItem(\n key,\n JSON.stringify({ someOtherField: \"data\" }),\n );\n\n expect(LocalStorageCache.getValue(key)).toBeUndefined();\n expect(global.localStorage.getItem(key)).toBeNull(); // Ensure item is removed\n });\n });\n});\n"],"mappings":"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","names":[]}
|
package/dist/nonNil.d.ts
ADDED
package/dist/nonNil.js
CHANGED
package/dist/nonNil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nonNil.ts"],"sourcesContent":["/**\n * Type asserts that `t` is neither null nor undefined.\n * Throws an error if `t` is null or undefined.\n */\nexport function nonNil<T>(t: T | null | undefined, varName = \"variable\"): T {\n if (t === null || t === undefined) {\n throw new Error(`Missing ${varName}`);\n }\n return t;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/nonNil.ts"],"sourcesContent":["/**\n * Type asserts that `t` is neither null nor undefined.\n * Throws an error if `t` is null or undefined.\n */\nexport function nonNil<T>(t: T | null | undefined, varName = \"variable\"): T {\n if (t === null || t === undefined) {\n throw new Error(`Missing ${varName}`);\n }\n return t;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,SAAS,OAAU,GAAyB,UAAU,YAAe;AAC1E,MAAI,MAAM,QAAQ,MAAM,QAAW;AACjC,UAAM,IAAI,MAAM,WAAW,OAAO,EAAE;AAAA,EACtC;AACA,SAAO;AACT;","names":[]}
|
package/dist/safeParseInt.js
CHANGED
package/dist/safeParseInt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/safeParseInt.ts"],"sourcesContent":["/**\n * Returns 0 if the string is not a valid number.\n */\nexport function safeParseInt(s: string, logError = false): number {\n const i = Number(s);\n\n if (isNaN(i)) {\n if (logError) {\n console.error(`Not a number: \"${s}\"`);\n }\n return 0;\n }\n\n return Math.floor(i);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/safeParseInt.ts"],"sourcesContent":["/**\n * Returns 0 if the string is not a valid number.\n */\nexport function safeParseInt(s: string, logError = false): number {\n const i = Number(s);\n\n if (isNaN(i)) {\n if (logError) {\n console.error(`Not a number: \"${s}\"`);\n }\n return 0;\n }\n\n return Math.floor(i);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,aAAa,GAAW,WAAW,OAAe;AAChE,QAAM,IAAI,OAAO,CAAC;AAElB,MAAI,MAAM,CAAC,GAAG;AACZ,QAAI,UAAU;AACZ,cAAQ,MAAM,kBAAkB,CAAC,GAAG;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AAEA,SAAO,KAAK,MAAM,CAAC;AACrB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choksheak/ts-utils",
|
|
3
3
|
"license": "The Unlicense",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Random Typescript utilities with support for full tree-shaking",
|
|
6
6
|
"private": false,
|
|
7
7
|
"scripts": {
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
"format": "prettier --write \"**/*.{js,ts}\"",
|
|
10
10
|
"test": "jest",
|
|
11
11
|
"test:watch": "jest --watch",
|
|
12
|
+
"clean": "rm -rf dist",
|
|
12
13
|
"build": "tsup src/*",
|
|
13
|
-
"
|
|
14
|
+
"gen-types": "tsc --emitDeclarationOnly --declaration",
|
|
15
|
+
"pub": "npm run build && npm run gen-types && npm publish --access=public"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
16
18
|
"README.md",
|