@putkoff/abstract-utilities 0.1.239 → 0.1.241
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/cjs/index.js
CHANGED
|
@@ -517,7 +517,6 @@ function fetchIt(endpoint_1) {
|
|
|
517
517
|
? JSON.stringify(body)
|
|
518
518
|
: undefined,
|
|
519
519
|
};
|
|
520
|
-
console.debug("➡️ secureFetchIt →", url, opts);
|
|
521
520
|
let res = yield fetch(url, opts);
|
|
522
521
|
if (!res.ok) {
|
|
523
522
|
const err = yield res.text();
|
|
@@ -1514,6 +1513,23 @@ function make_path(...paths) {
|
|
|
1514
1513
|
}
|
|
1515
1514
|
return real_path;
|
|
1516
1515
|
}
|
|
1516
|
+
function makePath(...paths) {
|
|
1517
|
+
var _a;
|
|
1518
|
+
const pathArray = ensure_list(paths);
|
|
1519
|
+
let real_path = '';
|
|
1520
|
+
for (let i = 0; i < pathArray.length; i++) {
|
|
1521
|
+
let seg = String((_a = pathArray[i]) !== null && _a !== void 0 ? _a : '');
|
|
1522
|
+
if (i === 0) {
|
|
1523
|
+
real_path = seg;
|
|
1524
|
+
}
|
|
1525
|
+
else {
|
|
1526
|
+
seg = eatInner(seg, ['/']);
|
|
1527
|
+
real_path = eatOuter(real_path, ['/']);
|
|
1528
|
+
real_path = `${real_path}/${seg}`;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
return real_path || '';
|
|
1532
|
+
}
|
|
1517
1533
|
function sanitizeFilename(filename) {
|
|
1518
1534
|
return filename
|
|
1519
1535
|
.toLowerCase()
|
|
@@ -1543,13 +1559,13 @@ function make_sanitized_path(...paths) {
|
|
|
1543
1559
|
}
|
|
1544
1560
|
return real_path || '';
|
|
1545
1561
|
}
|
|
1562
|
+
/** FIXED: your regexes were strings. This correctly joins without duplicate slashes. */
|
|
1546
1563
|
function normalizeUrl(base, p) {
|
|
1547
1564
|
if (!p)
|
|
1548
|
-
return base;
|
|
1549
|
-
const cleanBase = base.replace(
|
|
1550
|
-
const cleanPath = p.replace(
|
|
1551
|
-
|
|
1552
|
-
return `${cleanBase}/${cleanPath}`.replace(/([^:])\/{2,}/g, '$1/');
|
|
1565
|
+
return base.replace(/\/+$/g, '');
|
|
1566
|
+
const cleanBase = base.replace(/\/+$/g, '');
|
|
1567
|
+
const cleanPath = p.replace(/^\/+/g, '');
|
|
1568
|
+
return `${cleanBase}/${cleanPath}`.replace(/([^:])\/{2,}/g, '$1/'); // keep protocol //
|
|
1553
1569
|
}
|
|
1554
1570
|
|
|
1555
1571
|
/**
|
|
@@ -1974,6 +1990,7 @@ exports.isNum = isNum;
|
|
|
1974
1990
|
exports.isStrInString = isStrInString;
|
|
1975
1991
|
exports.isTokenExpired = isTokenExpired;
|
|
1976
1992
|
exports.isType = isType;
|
|
1993
|
+
exports.makePath = makePath;
|
|
1977
1994
|
exports.make_path = make_path;
|
|
1978
1995
|
exports.make_sanitized_path = make_sanitized_path;
|
|
1979
1996
|
exports.normalizeUrl = normalizeUrl;
|