@rtorcato/js-common 2.8.1 → 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 +7 -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/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/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,10 @@
|
|
|
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
|
+
|
|
1
8
|
## [2.8.1](https://github.com/rtorcato/js-common/compare/v2.8.0...v2.8.1) (2026-06-12)
|
|
2
9
|
|
|
3
10
|
|
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/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()})});
|
|
@@ -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
|
},
|