@ptx-showcase/utils 0.2.1 → 0.2.3

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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>{let t=new URLSearchParams;Object.entries(e).forEach(([e,n])=>{n==null||n===``||t.append(e,String(n))});let n=t.toString();return n?`?${n}`:``};exports.buildQueryParams=e;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>{let t=new URLSearchParams;Object.entries(e).forEach(([e,n])=>{n==null||n===``||Array.isArray(n)&&n.length===0||t.append(e,String(n))});let n=t.toString();return n?`?${n}`:``};exports.buildQueryParams=e;
@@ -2,7 +2,7 @@
2
2
  var e = (e) => {
3
3
  let t = new URLSearchParams();
4
4
  Object.entries(e).forEach(([e, n]) => {
5
- n == null || n === "" || t.append(e, String(n));
5
+ n == null || n === "" || Array.isArray(n) && n.length === 0 || t.append(e, String(n));
6
6
  });
7
7
  let n = t.toString();
8
8
  return n ? `?${n}` : "";
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>{let n=`-`+e,r=t.split(`,`).filter(Boolean);return r.includes(n)?r.filter(e=>e!==n).join(`,`):r.includes(e)?r.map(t=>t===e?n:t).join(`,`):[e,...r].join(`,`)};exports.buildSortParam=e;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>{let n=`-`+e,r=(t??``).split(`,`).filter(Boolean);return r.includes(n)?r.filter(e=>e!==n).join(`,`):r.includes(e)?r.map(t=>t===e?n:t).join(`,`):[e,...r].join(`,`)};exports.buildSortParam=e;
@@ -1 +1 @@
1
- export declare const buildSortParam: (field: string, prev: string) => string;
1
+ export declare const buildSortParam: (field: string, prev?: string) => string;
@@ -1,6 +1,6 @@
1
1
  //#region src/build-sort-param/index.ts
2
2
  var e = (e, t) => {
3
- let n = "-" + e, r = t.split(",").filter(Boolean);
3
+ let n = "-" + e, r = (t ?? "").split(",").filter(Boolean);
4
4
  return r.includes(n) ? r.filter((e) => e !== n).join(",") : r.includes(e) ? r.map((t) => t === e ? n : t).join(",") : [e, ...r].join(",");
5
5
  };
6
6
  //#endregion
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ptx-showcase/utils",
3
3
  "author": "ptx-showcase",
4
4
  "description": "Shared utilities for PTX Showcase projects",
5
- "version": "0.2.1",
5
+ "version": "0.2.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "license": "MIT",