@ptx-showcase/utils 0.0.5 → 0.1.1
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/build-query-params/index.cjs +1 -0
- package/dist/build-query-params/index.d.ts +1 -0
- package/dist/build-query-params/index.js +11 -0
- package/dist/clean-object/index.cjs +1 -0
- package/dist/clean-object/index.d.ts +6 -0
- package/dist/clean-object/index.js +9 -0
- package/dist/cookies/index.cjs +1 -1
- package/dist/cookies/index.js +13 -16
- package/dist/{cookies-DO7osa3F.cjs → cookies-BayERMbH.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -2
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +0 -0
- package/package.json +24 -8
|
@@ -0,0 +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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildQueryParams: <T extends object>(params: T) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/build-query-params/index.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
let t = new URLSearchParams();
|
|
4
|
+
Object.entries(e).forEach(([e, n]) => {
|
|
5
|
+
n == null || n === "" || t.append(e, String(n));
|
|
6
|
+
});
|
|
7
|
+
let n = t.toString();
|
|
8
|
+
return n ? `?${n}` : "";
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as buildQueryParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=e=>{let t={};return Object.entries(e).forEach(([e,n])=>{n!=null&&n!==``&&(t[e]=n)}),t};exports.cleanObject=e;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type EmptyValue = undefined | null | '';
|
|
2
|
+
export type CleanObjectResult<T extends Record<string, unknown>> = Partial<{
|
|
3
|
+
[K in keyof T]: Exclude<T[K], EmptyValue>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const cleanObject: <T extends Record<string, unknown>>(obj: T) => CleanObjectResult<T>;
|
|
6
|
+
export {};
|
package/dist/cookies/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cookies-BayERMbH.cjs");exports.defaultCookieOptions=e.t,exports.deleteCookie=e.n,exports.getCookie=e.r,exports.setCookie=e.i;
|
package/dist/cookies/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import e from
|
|
1
|
+
import e from "js-cookie";
|
|
2
2
|
var t = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
i = (t, n) => {
|
|
15
|
-
e.remove(t, n)
|
|
16
|
-
}
|
|
3
|
+
expires: 1 / 24,
|
|
4
|
+
secure: !0,
|
|
5
|
+
sameSite: "Strict"
|
|
6
|
+
}, n = (n, r, i) => {
|
|
7
|
+
e.set(n, r, {
|
|
8
|
+
...t,
|
|
9
|
+
...i
|
|
10
|
+
});
|
|
11
|
+
}, r = (t) => e.get(t), i = (t, n) => {
|
|
12
|
+
e.remove(t, n);
|
|
13
|
+
};
|
|
17
14
|
//#endregion
|
|
18
|
-
export { t as defaultCookieOptions, i as deleteCookie, r as getCookie, n as setCookie }
|
|
15
|
+
export { t as defaultCookieOptions, i as deleteCookie, r as getCookie, n as setCookie };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("js-cookie");c=s(c,1);var l={expires:1/24,secure:!0,sameSite:`Strict`},u=(e,t,n)=>{c.default.set(e,t,{...l,...n})},d=e=>c.default.get(e),f=(e,t)=>{c.default.remove(e,t)};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./cookies-BayERMbH.cjs"),t=require("./build-query-params/index.cjs"),n=require("./clean-object/index.cjs");exports.buildQueryParams=t.buildQueryParams,exports.cleanObject=n.cleanObject,exports.defaultCookieOptions=e.t,exports.deleteCookie=e.n,exports.getCookie=e.r,exports.setCookie=e.i;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { buildQueryParams as e } from "./build-query-params/index.js";
|
|
2
|
+
import { cleanObject as t } from "./clean-object/index.js";
|
|
3
|
+
import { defaultCookieOptions as n, deleteCookie as r, getCookie as i, setCookie as a } from "./cookies/index.js";
|
|
4
|
+
export { e as buildQueryParams, t as cleanObject, n as defaultCookieOptions, r as deleteCookie, i as getCookie, a as setCookie };
|
|
File without changes
|
|
File without changes
|
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.
|
|
5
|
+
"version": "0.1.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"license": "MIT",
|
|
@@ -35,6 +35,21 @@
|
|
|
35
35
|
"import": "./dist/cookies/index.js",
|
|
36
36
|
"require": "./dist/cookies/index.cjs",
|
|
37
37
|
"types": "./dist/cookies/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./build-query-params": {
|
|
40
|
+
"import": "./dist/build-query-params/index.js",
|
|
41
|
+
"require": "./dist/build-query-params/index.cjs",
|
|
42
|
+
"types": "./dist/build-query-params/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./clean-object": {
|
|
45
|
+
"import": "./dist/clean-object/index.js",
|
|
46
|
+
"require": "./dist/clean-object/index.cjs",
|
|
47
|
+
"types": "./dist/clean-object/index.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./types": {
|
|
50
|
+
"import": "./dist/types/index.js",
|
|
51
|
+
"require": "./dist/types/index.cjs",
|
|
52
|
+
"types": "./dist/types/index.d.ts"
|
|
38
53
|
}
|
|
39
54
|
},
|
|
40
55
|
"scripts": {
|
|
@@ -47,15 +62,16 @@
|
|
|
47
62
|
"access": "public"
|
|
48
63
|
},
|
|
49
64
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^25.
|
|
51
|
-
"oxlint": "^1.
|
|
65
|
+
"@types/node": "^25.9.1",
|
|
66
|
+
"oxlint": "^1.67.0",
|
|
52
67
|
"typescript": "~6.0.3",
|
|
53
|
-
"vite": "^8.0.
|
|
54
|
-
"vite-plugin-dts": "^
|
|
55
|
-
"vitest": "^4.1.
|
|
68
|
+
"vite": "^8.0.14",
|
|
69
|
+
"vite-plugin-dts": "^5.0.1",
|
|
70
|
+
"vitest": "^4.1.7"
|
|
56
71
|
},
|
|
57
72
|
"dependencies": {
|
|
58
|
-
"js-cookie": "^3.0.
|
|
59
|
-
"@types/js-cookie": "^3.0.6"
|
|
73
|
+
"js-cookie": "^3.0.7",
|
|
74
|
+
"@types/js-cookie": "^3.0.6",
|
|
75
|
+
"ky": "2.0.2"
|
|
60
76
|
}
|
|
61
77
|
}
|