cafe-utility 9.5.0 → 9.6.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/index.d.ts +1 -1
- package/index.js +4 -10
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -210,7 +210,7 @@ declare function getPreLine(string: string): string;
|
|
|
210
210
|
declare function containsWord(string: string, word: string): boolean;
|
|
211
211
|
declare function containsWords(string: string, words: string[]): boolean;
|
|
212
212
|
declare function getCached<T>(key: string, ttlMillis: number, handler: () => Promise<T>): Promise<T>;
|
|
213
|
-
declare function joinUrl(...parts:
|
|
213
|
+
declare function joinUrl(...parts: unknown[]): string;
|
|
214
214
|
declare function sortObject<T>(object: CafeObject<T>): CafeObject<T>;
|
|
215
215
|
declare function sortArray<T>(array: T[]): T[];
|
|
216
216
|
declare function sortAny(any: unknown): unknown;
|
package/index.js
CHANGED
|
@@ -1390,16 +1390,10 @@ async function getCached(key, ttlMillis, handler) {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
|
|
1392
1392
|
function joinUrl(...parts) {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
continue
|
|
1398
|
-
}
|
|
1399
|
-
const starts = part[0] === '/'
|
|
1400
|
-
const ends = part[part.length - 1] === '/'
|
|
1401
|
-
url += '/' + part.slice(starts ? 1 : 0, ends ? -1 : undefined)
|
|
1402
|
-
}
|
|
1393
|
+
const url = parts
|
|
1394
|
+
.filter(part => part && isString(part))
|
|
1395
|
+
.join('/')
|
|
1396
|
+
.replace(/([^:]\/)\/+/g, '$1')
|
|
1403
1397
|
return url
|
|
1404
1398
|
}
|
|
1405
1399
|
|