@cabloy/utils 1.0.37 → 1.0.39
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/utils.d.ts +1 -0
- package/dist/utils.js +11 -0
- package/package.json +2 -2
package/dist/utils.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare function combineParamsAndQuery(path: string, options?: {
|
|
|
14
14
|
}): string;
|
|
15
15
|
export declare function combineQueries(pagePath?: string, queries?: Record<string, any>): string;
|
|
16
16
|
export declare function defaultPathSerializer(pathName: string, pathParams?: Record<string, any>): string;
|
|
17
|
+
export declare function ensureArray(arr: any, sep?: string): any[] | undefined;
|
package/dist/utils.js
CHANGED
|
@@ -167,3 +167,14 @@ export function defaultPathSerializer(pathName, pathParams) {
|
|
|
167
167
|
}
|
|
168
168
|
return pathName;
|
|
169
169
|
}
|
|
170
|
+
export function ensureArray(arr, sep) {
|
|
171
|
+
if (arr === undefined || arr === null)
|
|
172
|
+
return undefined;
|
|
173
|
+
if (arr === '')
|
|
174
|
+
return [];
|
|
175
|
+
if (Array.isArray(arr))
|
|
176
|
+
return arr;
|
|
177
|
+
if (typeof arr === 'string' && sep !== null)
|
|
178
|
+
return arr.split(sep ?? ',');
|
|
179
|
+
return [arr];
|
|
180
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.39",
|
|
5
5
|
"description": "cabloy utils",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@cabloy/cel-js": "^0.7.4",
|
|
29
|
-
"@cabloy/module-info": "^1.3.
|
|
29
|
+
"@cabloy/module-info": "^1.3.26",
|
|
30
30
|
"@cabloy/word-utils": "^2.0.1",
|
|
31
31
|
"chevrotain": "^11.0.3",
|
|
32
32
|
"object-hash": "^3.0.0"
|