@cabloy/utils 2.0.16 → 2.0.18
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/index.js +1 -0
- package/dist/utils.d.ts +6 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -217,6 +217,7 @@ function combineQueries(pagePath, queries) {
|
|
|
217
217
|
const PATH_PARAM_RE = /\{([^{}/]+)\}/g;
|
|
218
218
|
const PATH_PARAM_RE2 = /:([^/]+)/g;
|
|
219
219
|
function defaultPathSerializer(pathName, pathParams) {
|
|
220
|
+
if (!pathName) return undefined;
|
|
220
221
|
pathParams = pathParams ?? {};
|
|
221
222
|
for (const item of [PATH_PARAM_RE, PATH_PARAM_RE2]) {
|
|
222
223
|
pathName = pathName.replace(item, (_, _part) => {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface IParamsAndQuery {
|
|
2
|
+
params?: Record<string, any>;
|
|
3
|
+
query?: Record<string, any>;
|
|
4
|
+
}
|
|
1
5
|
export declare function deprecated(oldUsage: any, newUsage: any): void;
|
|
2
6
|
export declare function catchError<T>(fnMethod: (...args: any[]) => Promise<T>): Promise<[T, undefined] | [undefined, Error]>;
|
|
3
7
|
export declare function catchErrorSync<T>(fnMethod: (...args: any[]) => T): [T, undefined] | [undefined, Error];
|
|
@@ -8,12 +12,9 @@ export declare function hasProperty(obj: object | undefined, name: string, sep?:
|
|
|
8
12
|
export declare function getProperty<T>(obj: object | undefined, name: string, sep?: string): T | undefined;
|
|
9
13
|
export declare function getPropertyObject<T>(obj: object | undefined, name: string, sep?: string): T | undefined;
|
|
10
14
|
export declare function getRandomInt(size: number, start?: number): number;
|
|
11
|
-
export declare function combineParamsAndQuery(path
|
|
12
|
-
params?: object;
|
|
13
|
-
query?: object;
|
|
14
|
-
}): string;
|
|
15
|
+
export declare function combineParamsAndQuery(path?: string, options?: IParamsAndQuery): string;
|
|
15
16
|
export declare function combineQueries(pagePath?: string, queries?: Record<string, any>): string;
|
|
16
|
-
export declare function defaultPathSerializer(pathName
|
|
17
|
+
export declare function defaultPathSerializer<T extends string | undefined>(pathName?: T, pathParams?: Record<string, any>): T extends string ? string : undefined;
|
|
17
18
|
export declare function ensureArray(arr: any, sep?: string): any[] | undefined;
|
|
18
19
|
export declare function stringLazy(fn: () => string): {
|
|
19
20
|
toString: () => string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.18",
|
|
5
5
|
"description": "cabloy utils",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@cabloy/module-info": "^1.3.
|
|
28
|
+
"@cabloy/module-info": "^1.3.41",
|
|
29
29
|
"@cabloy/word-utils": "^2.0.2",
|
|
30
30
|
"@marcbachmann/cel-js": "^6.5.1",
|
|
31
31
|
"object-hash": "^3.0.0"
|