@ptx-showcase/utils 0.0.5 → 0.1.0
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.js +13 -16
- 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 +18 -2
|
@@ -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: (params: Record<string, unknown>) => 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.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 };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./cookies-DO7osa3F.cjs`);exports.defaultCookieOptions=e.t,exports.deleteCookie=e.n,exports.getCookie=e.r,exports.setCookie=e.i;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./cookies-DO7osa3F.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.0
|
|
5
|
+
"version": "0.1.0",
|
|
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": {
|
|
@@ -56,6 +71,7 @@
|
|
|
56
71
|
},
|
|
57
72
|
"dependencies": {
|
|
58
73
|
"js-cookie": "^3.0.5",
|
|
59
|
-
"@types/js-cookie": "^3.0.6"
|
|
74
|
+
"@types/js-cookie": "^3.0.6",
|
|
75
|
+
"ky": "2.0.2"
|
|
60
76
|
}
|
|
61
77
|
}
|