@rtorcato/js-common 2.8.0 → 2.8.2
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/arrays/arrays.test-d.d.ts +2 -0
- package/dist/arrays/arrays.test-d.d.ts.map +1 -0
- package/dist/arrays/arrays.test-d.js +1 -0
- package/dist/arrays/index.js +1 -1
- package/dist/chunks/chunk-5IA77ERW.js +1 -0
- package/dist/chunks/chunk-ARW46OJS.js +1 -0
- package/dist/emails/index.d.ts +5 -0
- package/dist/emails/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/logger.d.ts +4 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logging/index.d.ts +4 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/mime-types/db.d.ts +14 -0
- package/dist/mime-types/db.d.ts.map +1 -1
- package/dist/mime-types/index.d.ts +6 -0
- package/dist/mime-types/index.d.ts.map +1 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/objects.test-d.d.ts +2 -0
- package/dist/objects/objects.test-d.d.ts.map +1 -0
- package/dist/objects/objects.test-d.js +1 -0
- package/dist/security/index.d.ts +5 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/try/trycatch.d.ts +17 -0
- package/dist/try/trycatch.d.ts.map +1 -1
- package/dist/try/trycatch.test-d.d.ts +2 -0
- package/dist/try/trycatch.test-d.d.ts.map +1 -0
- package/dist/try/trycatch.test-d.js +1 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.8.2](https://github.com/rtorcato/js-common/compare/v2.8.1...v2.8.2) (2026-07-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **release:** upgrade npm for OIDC trusted publishing ([#110](https://github.com/rtorcato/js-common/issues/110)) ([93db8b5](https://github.com/rtorcato/js-common/commit/93db8b56041e916c63c1e250312e8527df931cc4))
|
|
7
|
+
|
|
8
|
+
## [2.8.1](https://github.com/rtorcato/js-common/compare/v2.8.0...v2.8.1) (2026-06-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **docs:** broken links + sidebar + module summaries ([#70](https://github.com/rtorcato/js-common/issues/70)) ([539923a](https://github.com/rtorcato/js-common/commit/539923addefa80c7564facce87d3664226d9fb75)), closes [#0a0e16](https://github.com/rtorcato/js-common/issues/0a0e16)
|
|
14
|
+
|
|
1
15
|
# [2.8.0](https://github.com/rtorcato/js-common/compare/v2.7.0...v2.8.0) (2026-06-12)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -209,7 +209,7 @@ pnpm run benchmark
|
|
|
209
209
|
|
|
210
210
|
## Documentation site
|
|
211
211
|
|
|
212
|
-
The full documentation site lives in [`apps/
|
|
212
|
+
The full documentation site lives in [`apps/docs`](./apps/docs) and is built with [Docusaurus](https://docusaurus.io/). It auto-deploys to GitHub Pages on every push to `main` that touches `apps/docs/**`.
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
215
|
# Run the docs locally (http://localhost:4321/js-common)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrays.test-d.d.ts","sourceRoot":"","sources":["../../src/arrays/arrays.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n,b as a,c as t,e as u,h as s}from"../chunks/chunk-5IA77ERW.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as o,expectTypeOf as e,it as r}from"vitest";o("arrays \u2014 types",()=>{r("first/last preserve element type and add undefined",()=>{e(n([1,2,3])).toEqualTypeOf(),e(n(["a","b"])).toEqualTypeOf(),e(a([{id:1}])).toEqualTypeOf()}),r("unique preserves element type",()=>{e(t([1,2,3])).toEqualTypeOf(),e(t(["a"])).toEqualTypeOf()}),r("chunk returns array of arrays of the element type",()=>{e(u([1,2,3],2)).toEqualTypeOf(),e(u(["a","b"],1)).toEqualTypeOf()}),r("groupBy preserves element type in the grouped arrays",()=>{let i=s([{kind:"a",n:1}],p=>p.kind);e(i).toEqualTypeOf()})});
|
package/dist/arrays/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"../chunks/chunk-5IA77ERW.js";import"../chunks/chunk-ANN5UYCF.js";export{e as chunk,f as compact,a as first,d as flatten,h as groupBy,b as last,g as shuffle,c as unique};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(n){return n[0]}function T(n){return n.length?n[n.length-1]:void 0}function f(n){return Array.from(new Set(n))}function i(n){return n.flat()}function l(n,e){if(e<1)throw new Error("Chunk size must be at least 1");let t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function s(n){return n.filter(Boolean)}function c(n){let e=n.slice();for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function h(n,e){return n.reduce((t,r)=>{let o=e(r);return t[o]||(t[o]=[]),t[o].push(r),t},{})}export{u as a,T as b,f as c,i as d,l as e,s as f,c as g,h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(n){return Object.prototype.toString.call(n)==="[object Object]"}function s(n,o){let t={...n};for(let e in o)r(o[e])&&r(t[e])?t[e]=s(t[e],o[e]):t[e]=o[e];return t}function c(n,o){let t={...n};for(let e of o)delete t[e];return t}function i(n,o){let t={};for(let e of o)e in n&&(t[e]=n[e]);return t}function T(n){return structuredClone(n)}export{r as a,s as b,c,i as d,T as e};
|
package/dist/emails/index.d.ts
CHANGED
|
@@ -22,5 +22,10 @@ export declare function maskEmail(email: string): string;
|
|
|
22
22
|
* @returns The domain part of the email, or an empty string if invalid.
|
|
23
23
|
*/
|
|
24
24
|
export declare function getEmailDomain(email: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if an email address is from a free provider (e.g., gmail, yahoo, outlook).
|
|
27
|
+
* @param email The email address.
|
|
28
|
+
* @returns True if the email is from a free provider, false otherwise.
|
|
29
|
+
*/
|
|
25
30
|
export declare function isFreeEmailProvider(email: string): boolean;
|
|
26
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emails/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emails/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAaD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D"}
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './logger';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,eAAO,MAAM,MAAM,6BAyBO,CAAA"}
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB;;;GAGG;AACH,eAAO,MAAM,MAAM,6BAyBO,CAAA"}
|
package/dist/logging/index.d.ts
CHANGED
|
@@ -19,11 +19,14 @@ export declare function error(message: string): void;
|
|
|
19
19
|
* @param message The info message.
|
|
20
20
|
*/
|
|
21
21
|
export declare function info(message: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* One of the four standard console methods used by `captureConsole`.
|
|
24
|
+
*/
|
|
25
|
+
export type ConsoleLevel = 'log' | 'info' | 'warn' | 'error';
|
|
22
26
|
/**
|
|
23
27
|
* Captures all console output and returns a function to restore it.
|
|
24
28
|
* @param callback Function to call with each log message.
|
|
25
29
|
* @returns {() => void} Restore function.
|
|
26
30
|
*/
|
|
27
|
-
export type ConsoleLevel = 'log' | 'info' | 'warn' | 'error';
|
|
28
31
|
export declare function captureConsole(callback: (type: ConsoleLevel, ...args: unknown[]) => void): () => void;
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,OAAgB,GAAG,IAAI,CAIjG;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,OAAgB,GAAG,IAAI,CAIjG;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACxD,MAAM,IAAI,CAgBZ"}
|
package/dist/mime-types/db.d.ts
CHANGED
|
@@ -4592,14 +4592,28 @@ declare const mimeTypesInternal: {
|
|
|
4592
4592
|
readonly compressible: null;
|
|
4593
4593
|
};
|
|
4594
4594
|
};
|
|
4595
|
+
/**
|
|
4596
|
+
* Union of every file extension string (e.g. `'pdf'`, `'png'`) present in the MIME-type database.
|
|
4597
|
+
*/
|
|
4595
4598
|
export type FileExtension = (typeof mimeTypesInternal)[keyof typeof mimeTypesInternal]['extensions'][number];
|
|
4599
|
+
/**
|
|
4600
|
+
* Union of every MIME type string (e.g. `'application/json'`) present in the database.
|
|
4601
|
+
*/
|
|
4596
4602
|
export type MimeType = keyof typeof mimeTypesInternal;
|
|
4597
4603
|
type TypedMimeTypes = Record<MimeType, {
|
|
4598
4604
|
source: string;
|
|
4599
4605
|
extensions: FileExtension[];
|
|
4600
4606
|
compressible: boolean | null;
|
|
4601
4607
|
}>;
|
|
4608
|
+
/**
|
|
4609
|
+
* Full MIME-type database keyed by `MimeType`, with `source`, `extensions`, and
|
|
4610
|
+
* `compressible` metadata per entry.
|
|
4611
|
+
*/
|
|
4602
4612
|
export declare const mimeTypes: TypedMimeTypes;
|
|
4613
|
+
/**
|
|
4614
|
+
* Metadata record for a given `MimeType` — its `source`, associated `extensions`, and
|
|
4615
|
+
* `compressible` flag.
|
|
4616
|
+
*/
|
|
4603
4617
|
export type MimeValue = (typeof mimeTypes)[MimeType];
|
|
4604
4618
|
export {};
|
|
4605
4619
|
//# sourceMappingURL=db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/mime-types/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0/Ib,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,aAAa,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAErD,KAAK,cAAc,GAAG,MAAM,CAC3B,QAAQ,EACR;IACC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,aAAa,EAAE,CAAA;IAC3B,YAAY,EAAE,OAAO,GAAG,IAAI,CAAA;CAC5B,CACD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAmC,cAAc,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { FileExtension, MimeType } from './db.js';
|
|
15
15
|
export * from './db.js';
|
|
16
|
+
/**
|
|
17
|
+
* Map from `MimeType` to its associated file extensions, populated from the database.
|
|
18
|
+
*/
|
|
16
19
|
export declare const extensions: Record<MimeType, FileExtension[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Map from `FileExtension` to its canonical `MimeType`, populated from the database.
|
|
22
|
+
*/
|
|
17
23
|
export declare const types: Record<FileExtension, MimeType>;
|
|
18
24
|
/**
|
|
19
25
|
* Lookup the MIME type for a file path/extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mime-types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAOtD,cAAc,SAAS,CAAA;AAOvB,eAAO,MAAM,UAAU,EAAS,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mime-types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAOtD,cAAc,SAAS,CAAA;AAOvB;;GAEG;AACH,eAAO,MAAM,UAAU,EAAS,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,KAAK,EAAS,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;AAK1D;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,swzBAalC"}
|
package/dist/objects/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../chunks/chunk-ARW46OJS.js";import"../chunks/chunk-ANN5UYCF.js";export{e as deepClone,b as deepMerge,a as isPlainObject,c as omit,d as pick};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.test-d.d.ts","sourceRoot":"","sources":["../../src/objects/objects.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as n,c,d as p,e as a}from"../chunks/chunk-ARW46OJS.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as i,expectTypeOf as t,it as o}from"vitest";i("objects \u2014 types",()=>{o("pick narrows to the selected keys",()=>{let e=p({a:1,b:"two",c:!0},["a","c"]);t(e).toEqualTypeOf(),e.b}),o("omit drops the listed keys",()=>{let e=c({a:1,b:"two",c:!0},["b"]);t(e).toEqualTypeOf(),e.b}),o("deepMerge yields the intersection type",()=>{let b=n({x:1},{y:"two"});t(b).toEqualTypeOf()}),o("deepClone is identity over the input type",()=>{t(a({nested:{id:1}})).toEqualTypeOf()})});
|
package/dist/security/index.d.ts
CHANGED
|
@@ -10,5 +10,10 @@ export declare function sanitizeString(str: string): string;
|
|
|
10
10
|
* @returns True if the password is strong, false otherwise.
|
|
11
11
|
*/
|
|
12
12
|
export declare function isStrongPassword(password: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a cryptographically secure random token (hex string).
|
|
15
|
+
* @param length The number of bytes (not hex chars).
|
|
16
|
+
* @returns A random hex string.
|
|
17
|
+
*/
|
|
13
18
|
export declare function generateSecureToken(length?: number): string;
|
|
14
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAK,GAAG,MAAM,CAEvD"}
|
package/dist/security/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as t}from"node:crypto";function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as t}from"node:crypto";function e(r){return r.replace(/<script.*?>.*?<\/script>/gi,"").replace(/on\w+\s*=\s*(['"]).*?\1/gi,"")}function i(r){return/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/.test(r)}function o(r=32){return t(r).toString("hex")}export{o as generateSecureToken,i as isStrongPassword,e as sanitizeString};
|
package/dist/try/trycatch.d.ts
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Successful branch of a `Result` — carries the value and a `null` error.
|
|
3
|
+
*/
|
|
1
4
|
export type Success<T> = {
|
|
2
5
|
data: T;
|
|
3
6
|
error: null;
|
|
4
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Error branch of a `Result` — carries a `null` value and an error of type `E`.
|
|
10
|
+
*/
|
|
5
11
|
export type Failure<E> = {
|
|
6
12
|
data: null;
|
|
7
13
|
error: E;
|
|
8
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Go-style discriminated union representing either a `Success<T>` or a `Failure<E>`,
|
|
17
|
+
* for async code that prefers explicit error returns over thrown exceptions.
|
|
18
|
+
*/
|
|
9
19
|
export type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
20
|
+
/**
|
|
21
|
+
* Type guard that narrows a `Result` to its `Success` branch when the error is `null`.
|
|
22
|
+
*/
|
|
10
23
|
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Run an async function and capture any thrown error into a `Result`, eliminating
|
|
26
|
+
* try/catch at the call site.
|
|
27
|
+
*/
|
|
11
28
|
export declare function tryCatch<T, E = Error>(fn: () => Promise<T>): Promise<Result<T, E>>;
|
|
12
29
|
//# sourceMappingURL=trycatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trycatch.d.ts","sourceRoot":"","sources":["../../src/try/trycatch.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE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AED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAOxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trycatch.test-d.d.ts","sourceRoot":"","sources":["../../src/try/trycatch.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,b as t}from"../chunks/chunk-XAQ7VMV4.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as l,expectTypeOf as e,it as s}from"vitest";l("try \u2014 types",()=>{s("Result<T,E> is the union of Success<T> and Failure<E>",()=>{e().toEqualTypeOf(),e().toEqualTypeOf()}),s("isSuccess narrows Result to Success in the true branch",()=>{let r={data:1,error:null};u(r)?(e(r).toEqualTypeOf(),e(r.data).toEqualTypeOf(),e(r.error).toEqualTypeOf()):e(r).toEqualTypeOf()}),s("tryCatch returns Promise<Result<T, E>> with the resolved type",async()=>{let r=t(async()=>42);e(r).toEqualTypeOf();let o=t(async()=>"x");e(o).toEqualTypeOf()})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rtorcato/js-common",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "JavaScript and TypeScript common code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"test": "vitest",
|
|
41
41
|
"test:watch": "vitest --watch",
|
|
42
42
|
"coverage": "vitest run --coverage",
|
|
43
|
+
"size": "size-limit",
|
|
43
44
|
"benchmark": "node scripts/benchmark.mjs",
|
|
44
45
|
"docs:generate": "node scripts/generate-module-docs.mjs",
|
|
45
46
|
"commit": "cz",
|
|
@@ -252,6 +253,7 @@
|
|
|
252
253
|
"@semantic-release/github": "^12.0.0",
|
|
253
254
|
"@semantic-release/npm": "^13.1.1",
|
|
254
255
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
256
|
+
"@size-limit/preset-small-lib": "^12.1.0",
|
|
255
257
|
"@types/chalk-animation": "^1.6.3",
|
|
256
258
|
"@types/figlet": "^1.7.0",
|
|
257
259
|
"@types/luxon": "^3.7.1",
|
|
@@ -259,11 +261,13 @@
|
|
|
259
261
|
"@vitest/coverage-istanbul": "^4.0.17",
|
|
260
262
|
"cross-env": "^10.1.0",
|
|
261
263
|
"esbuild": "^0.27.4",
|
|
264
|
+
"fast-check": "^4.8.0",
|
|
262
265
|
"husky": "^9.1.7",
|
|
263
266
|
"jsdom": "^29.0.1",
|
|
264
267
|
"knip": "^6.14.2",
|
|
265
268
|
"rimraf": "^6.0.1",
|
|
266
269
|
"semantic-release": "^25.0.1",
|
|
270
|
+
"size-limit": "^12.1.0",
|
|
267
271
|
"typescript": "^6.0.2",
|
|
268
272
|
"vitest": "^4.0.17"
|
|
269
273
|
},
|