@putkoff/abstract-utilities 1.0.47 → 1.0.52
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 +285 -98
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +257 -98
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +83 -50
- package/dist/types/functions/auth_utils/imports.d.ts +0 -0
- package/dist/types/functions/auth_utils/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/token_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/imports.d.ts +0 -0
- package/dist/types/functions/config_utils/index.d.ts +0 -0
- package/dist/types/functions/config_utils/src/config_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/src/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/constants.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/imports.d.ts +0 -0
- package/dist/types/functions/env_utils/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/window_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/imports.d.ts +0 -0
- package/dist/types/functions/fetch_utils/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/fetch_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/url_utils.d.ts +1 -0
- package/dist/types/functions/fetch_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/index.d.ts +0 -0
- package/dist/types/functions/math_utils/constants.d.ts +0 -0
- package/dist/types/functions/math_utils/conversions.d.ts +0 -0
- package/dist/types/functions/math_utils/index.d.ts +0 -0
- package/dist/types/functions/math_utils/safe_math.d.ts +0 -0
- package/dist/types/functions/math_utils/scaleInterfaces.d.ts +4 -0
- package/dist/types/functions/path_utils/imports.d.ts +0 -0
- package/dist/types/functions/path_utils/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/base_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/function_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/misc_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/path_utils.d.ts +42 -6
- package/dist/types/functions/path_utils/src/paths.d.ts +0 -0
- package/dist/types/functions/path_utils/src/src_dirs.d.ts +0 -0
- package/dist/types/functions/read_utils/imports.d.ts +0 -0
- package/dist/types/functions/read_utils/index.d.ts +0 -0
- package/dist/types/functions/read_utils/src/index.d.ts +0 -0
- package/dist/types/functions/read_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/rndm_utils/imports.d.ts +0 -0
- package/dist/types/functions/rndm_utils/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/safe_utils/imports.d.ts +0 -0
- package/dist/types/functions/safe_utils/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_document.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_globals.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_storage.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_window.d.ts +0 -0
- package/dist/types/functions/string_utils/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/string_utils.d.ts +12 -28
- package/dist/types/functions/type_utils/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/clean_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/ensure_utils.d.ts +22 -14
- package/dist/types/functions/type_utils/src/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/src/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/json_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/list_utils.d.ts +4 -0
- package/dist/types/functions/type_utils/src/mime_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/type_utils.d.ts +0 -0
- package/dist/types/functions/ui_utils/imports.d.ts +0 -0
- package/dist/types/functions/ui_utils/index.d.ts +0 -0
- package/dist/types/functions/ui_utils/src/button.d.ts +0 -0
- package/dist/types/functions/ui_utils/src/checkbox.d.ts +0 -0
- package/dist/types/functions/ui_utils/src/index.d.ts +0 -0
- package/dist/types/functions/ui_utils/src/input.d.ts +0 -0
- package/dist/types/functions/ui_utils/src/spinner.d.ts +0 -0
- package/dist/types/functions/variable_utils/imports.d.ts +0 -0
- package/dist/types/functions/variable_utils/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/variable_utils.d.ts +0 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/types/index.d.ts +0 -0
- package/dist/types/types/src/ChangePassword.d.ts +0 -0
- package/dist/types/types/src/Files.d.ts +0 -0
- package/dist/types/types/src/index.d.ts +0 -0
- package/dist/types/types/src/login.d.ts +0 -0
- package/dist/types/types/src/logout.d.ts +0 -0
- package/dist/types/types/src/utils.d.ts +0 -0
- package/dist/types/utils/imports.d.ts +0 -0
- package/dist/types/utils/index.d.ts +0 -0
- package/dist/types/utils/src/Input.d.ts +0 -0
- package/dist/types/utils/src/config.d.ts +0 -0
- package/dist/types/utils/src/index.d.ts +0 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -690,6 +690,9 @@ function url_to_path(urlStr, all_paths) {
|
|
|
690
690
|
}
|
|
691
691
|
return null;
|
|
692
692
|
}
|
|
693
|
+
function urljoin(...parts) {
|
|
694
|
+
return urlJoin(...parts);
|
|
695
|
+
}
|
|
693
696
|
|
|
694
697
|
function assertPath(path) {
|
|
695
698
|
if (typeof path !== 'string') {
|
|
@@ -1193,39 +1196,126 @@ posix.posix = posix;
|
|
|
1193
1196
|
|
|
1194
1197
|
var pathBrowserify = posix;
|
|
1195
1198
|
|
|
1199
|
+
function split_outside_brackets(s) {
|
|
1200
|
+
let depth = 0;
|
|
1201
|
+
let start = 0;
|
|
1202
|
+
const out = [];
|
|
1203
|
+
for (let i = 0; i < s.length; i++) {
|
|
1204
|
+
const c = s[i];
|
|
1205
|
+
if (c === "[")
|
|
1206
|
+
depth++;
|
|
1207
|
+
else if (c === "]")
|
|
1208
|
+
depth--;
|
|
1209
|
+
// split only when NOT inside brackets
|
|
1210
|
+
if (c === "," && depth === 0) {
|
|
1211
|
+
out.push(s.slice(start, i));
|
|
1212
|
+
start = i + 1;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
out.push(s.slice(start));
|
|
1216
|
+
return out;
|
|
1217
|
+
}
|
|
1218
|
+
function parse_nested_list(s) {
|
|
1219
|
+
// strip outer brackets
|
|
1220
|
+
const inner = s.slice(1, -1).trim();
|
|
1221
|
+
const parts = split_outside_brackets(inner);
|
|
1222
|
+
const result = [];
|
|
1223
|
+
for (let p of parts) {
|
|
1224
|
+
p = p.trim();
|
|
1225
|
+
if (p.startsWith("[") && p.endsWith("]")) {
|
|
1226
|
+
// recursively parse nested list
|
|
1227
|
+
result.push(parse_nested_list(p));
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
result.push(p);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
return result;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1196
1236
|
function ensure_list(obj) {
|
|
1197
|
-
|
|
1198
|
-
|
|
1237
|
+
if (obj == null)
|
|
1238
|
+
return [];
|
|
1239
|
+
if (Array.isArray(obj)) {
|
|
1240
|
+
return obj.flatMap(item => ensure_list(item));
|
|
1241
|
+
}
|
|
1242
|
+
const s = String(obj).trim();
|
|
1243
|
+
if (s.startsWith("[") && s.endsWith("]")) {
|
|
1244
|
+
return parse_nested_list(s);
|
|
1245
|
+
}
|
|
1246
|
+
return split_outside_brackets(s).map(x => x.trim());
|
|
1199
1247
|
}
|
|
1200
1248
|
// coerce any single value into a number (0 if it can't)
|
|
1201
1249
|
function ensure_number(x) {
|
|
1202
1250
|
const n = Number(x);
|
|
1203
1251
|
return isNaN(n) ? 0 : n;
|
|
1204
1252
|
}
|
|
1205
|
-
function ensure_array(input) {
|
|
1206
|
-
if (typeof input === 'string') {
|
|
1207
|
-
return [input];
|
|
1208
|
-
}
|
|
1209
|
-
if (Array.isArray(input)) {
|
|
1210
|
-
return input.map(item => ensure_string(item));
|
|
1211
|
-
}
|
|
1212
|
-
return [];
|
|
1213
|
-
}
|
|
1214
1253
|
function ensure_string(obj) {
|
|
1215
1254
|
return String(obj);
|
|
1216
1255
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1256
|
+
function ensurelist(obj) {
|
|
1257
|
+
return ensure_list(obj);
|
|
1258
|
+
}
|
|
1259
|
+
function assureList(obj) {
|
|
1260
|
+
return ensure_list(obj);
|
|
1261
|
+
}
|
|
1262
|
+
function assure_list(obj) {
|
|
1263
|
+
return ensure_list(obj);
|
|
1264
|
+
}
|
|
1265
|
+
function ensureList(obj) {
|
|
1266
|
+
return ensure_list(obj);
|
|
1267
|
+
}
|
|
1268
|
+
function assurelist(obj) {
|
|
1269
|
+
return ensure_list(obj);
|
|
1270
|
+
}
|
|
1271
|
+
function ensurenumber(x) {
|
|
1272
|
+
return ensure_number(x);
|
|
1273
|
+
}
|
|
1274
|
+
function assureNumber(x) {
|
|
1275
|
+
return ensure_number(x);
|
|
1276
|
+
}
|
|
1277
|
+
function ensureNumber(x) {
|
|
1278
|
+
return ensure_number(x);
|
|
1279
|
+
}
|
|
1280
|
+
function assurenumber(x) {
|
|
1281
|
+
return ensure_number(x);
|
|
1282
|
+
}
|
|
1283
|
+
function assure_number(x) {
|
|
1284
|
+
return ensure_number(x);
|
|
1285
|
+
}
|
|
1286
|
+
function ensurestring(obj) {
|
|
1287
|
+
return ensure_string(obj);
|
|
1288
|
+
}
|
|
1289
|
+
function ensureString(obj) {
|
|
1290
|
+
return ensure_string(obj);
|
|
1291
|
+
}
|
|
1292
|
+
function assureString(obj) {
|
|
1293
|
+
return ensure_string(obj);
|
|
1294
|
+
}
|
|
1295
|
+
function assurestring(obj) {
|
|
1296
|
+
return ensure_string(obj);
|
|
1297
|
+
}
|
|
1298
|
+
function assure_string(obj) {
|
|
1299
|
+
return ensure_string(obj);
|
|
1300
|
+
}
|
|
1301
|
+
function assurearray(obj) {
|
|
1302
|
+
return ensure_list(obj);
|
|
1303
|
+
}
|
|
1304
|
+
function ensurearray(obj) {
|
|
1305
|
+
return ensure_list(obj);
|
|
1306
|
+
}
|
|
1307
|
+
function ensure_array(obj) {
|
|
1308
|
+
return ensure_list(obj);
|
|
1309
|
+
}
|
|
1310
|
+
function ensureArray(obj) {
|
|
1311
|
+
return ensure_list(obj);
|
|
1312
|
+
}
|
|
1313
|
+
function assure_array(obj) {
|
|
1314
|
+
return ensure_list(obj);
|
|
1315
|
+
}
|
|
1316
|
+
function assureArray(obj) {
|
|
1317
|
+
return ensure_list(obj);
|
|
1318
|
+
}
|
|
1229
1319
|
|
|
1230
1320
|
function cleanText(input) {
|
|
1231
1321
|
// Replace delimiters with spaces and split
|
|
@@ -1692,71 +1782,80 @@ function stripPrefixes(str, bases = []) {
|
|
|
1692
1782
|
}
|
|
1693
1783
|
return str;
|
|
1694
1784
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
function eatInner(str, listObjects) {
|
|
1704
|
-
if (!Array.isArray(listObjects)) {
|
|
1705
|
-
listObjects = [listObjects];
|
|
1785
|
+
function tryEatPrefix(str, length, ...objs) {
|
|
1786
|
+
str = String(str);
|
|
1787
|
+
objs = ensure_list(objs);
|
|
1788
|
+
const prefix = str.slice(0, length);
|
|
1789
|
+
if (length < 0) {
|
|
1790
|
+
const start = str.length + length;
|
|
1791
|
+
const actualPrefix = str.slice(start);
|
|
1792
|
+
return objs.includes(actualPrefix) ? [str.slice(0, start), true] : [str, false];
|
|
1706
1793
|
}
|
|
1707
|
-
|
|
1794
|
+
if (objs.includes(prefix)) {
|
|
1795
|
+
return [str.slice(length), true];
|
|
1796
|
+
}
|
|
1797
|
+
return [str, false];
|
|
1798
|
+
}
|
|
1799
|
+
/** Python-equivalent eatInner */
|
|
1800
|
+
function eatInner(str, listObjects) {
|
|
1708
1801
|
str = String(str);
|
|
1709
|
-
|
|
1710
|
-
while
|
|
1802
|
+
const chars = Array.isArray(listObjects) ? listObjects : [listObjects];
|
|
1803
|
+
// Keep removing from left while leftmost char is in the set
|
|
1804
|
+
while (str.length > 0 && chars.includes(str[0])) {
|
|
1711
1805
|
str = str.slice(1);
|
|
1712
1806
|
}
|
|
1713
1807
|
return str;
|
|
1714
1808
|
}
|
|
1715
|
-
/**
|
|
1716
|
-
* Removes characters from the end of the string
|
|
1717
|
-
* if they are found in the list of characters.
|
|
1718
|
-
*
|
|
1719
|
-
* @param str - The input string.
|
|
1720
|
-
* @param listObjects - A string or an array of characters to remove.
|
|
1721
|
-
* @returns The modified string.
|
|
1722
|
-
*/
|
|
1809
|
+
/** Python-equivalent eatOuter */
|
|
1723
1810
|
function eatOuter(str, listObjects) {
|
|
1724
|
-
if (!Array.isArray(listObjects)) {
|
|
1725
|
-
listObjects = [listObjects];
|
|
1726
|
-
}
|
|
1727
|
-
// Ensure str is a string
|
|
1728
1811
|
str = String(str);
|
|
1729
|
-
|
|
1730
|
-
|
|
1812
|
+
const chars = Array.isArray(listObjects) ? listObjects : [listObjects];
|
|
1813
|
+
if (!str || chars.length === 0)
|
|
1814
|
+
return str;
|
|
1815
|
+
for (let i = 0; i < str.length; i++) {
|
|
1816
|
+
if (!str)
|
|
1817
|
+
return str;
|
|
1818
|
+
const last = str[str.length - 1];
|
|
1819
|
+
if (!chars.includes(last)) {
|
|
1820
|
+
return str;
|
|
1821
|
+
}
|
|
1731
1822
|
str = str.slice(0, -1);
|
|
1732
1823
|
}
|
|
1733
1824
|
return str;
|
|
1734
1825
|
}
|
|
1735
|
-
/**
|
|
1736
|
-
* Removes characters from both the beginning and the end of the string
|
|
1737
|
-
* if they are found in the list of characters.
|
|
1738
|
-
*
|
|
1739
|
-
* @param str - The input string.
|
|
1740
|
-
* @param listObjects - A string or an array of characters to remove.
|
|
1741
|
-
* @returns The modified string.
|
|
1742
|
-
*/
|
|
1826
|
+
/** Python-equivalent eatAll */
|
|
1743
1827
|
function eatAll(str, listObjects) {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1828
|
+
str = String(str);
|
|
1829
|
+
const chars = Array.isArray(listObjects) ? listObjects : [listObjects];
|
|
1830
|
+
str = eatInner(str, chars);
|
|
1831
|
+
str = eatOuter(str, chars);
|
|
1832
|
+
return str;
|
|
1833
|
+
}
|
|
1834
|
+
// Plug in the actual version from your project
|
|
1835
|
+
function get_alpha_ints(opts) {
|
|
1836
|
+
// REPLACE WITH YOUR REAL IMPLEMENTATION
|
|
1837
|
+
return [];
|
|
1838
|
+
}
|
|
1839
|
+
/** Python-equivalent eatElse */
|
|
1840
|
+
function eatElse(stringObj, chars, ints = true, alpha = true, lower = true, capitalize = true, string = true, listObj = true) {
|
|
1841
|
+
stringObj = String(stringObj);
|
|
1842
|
+
const alphaInts = get_alpha_ints();
|
|
1843
|
+
let ls = ensure_list(chars || []).concat(alphaInts);
|
|
1844
|
+
while (true) {
|
|
1845
|
+
if (!stringObj)
|
|
1846
|
+
return stringObj;
|
|
1847
|
+
const startOk = !ls.includes(stringObj[0]);
|
|
1848
|
+
const endOk = !ls.includes(stringObj[stringObj.length - 1]);
|
|
1849
|
+
const shouldEat = startOk || endOk;
|
|
1850
|
+
if (!shouldEat)
|
|
1851
|
+
return stringObj;
|
|
1852
|
+
if (stringObj && startOk) {
|
|
1853
|
+
stringObj = stringObj.length === 1 ? "" : stringObj.slice(1);
|
|
1854
|
+
}
|
|
1855
|
+
if (stringObj && endOk) {
|
|
1856
|
+
stringObj = stringObj.length === 1 ? "" : stringObj.slice(0, -1);
|
|
1757
1857
|
}
|
|
1758
1858
|
}
|
|
1759
|
-
return result;
|
|
1760
1859
|
}
|
|
1761
1860
|
function tryParse(obj) {
|
|
1762
1861
|
try {
|
|
@@ -1780,6 +1879,15 @@ function create_list_string(array_obj) {
|
|
|
1780
1879
|
}
|
|
1781
1880
|
return string;
|
|
1782
1881
|
}
|
|
1882
|
+
function eatall(str, listObjects) {
|
|
1883
|
+
return eatAll(str, listObjects);
|
|
1884
|
+
}
|
|
1885
|
+
function eatinner(str, listObjects) {
|
|
1886
|
+
return eatInner(str, listObjects);
|
|
1887
|
+
}
|
|
1888
|
+
function eatouter(str, listObjects) {
|
|
1889
|
+
return eatOuter(str, listObjects);
|
|
1890
|
+
}
|
|
1783
1891
|
|
|
1784
1892
|
/**
|
|
1785
1893
|
* In the browser we already have a WHATWG URL constructor on window.
|
|
@@ -1814,9 +1922,11 @@ function get_basename(filePath) {
|
|
|
1814
1922
|
return '';
|
|
1815
1923
|
return pathBrowserify.basename(filePath);
|
|
1816
1924
|
}
|
|
1817
|
-
function get_filename(
|
|
1818
|
-
|
|
1819
|
-
|
|
1925
|
+
function get_filename(filePath) {
|
|
1926
|
+
if (!filePath)
|
|
1927
|
+
return '';
|
|
1928
|
+
const ext = pathBrowserify.extname(filePath);
|
|
1929
|
+
return pathBrowserify.basename(filePath, ext);
|
|
1820
1930
|
}
|
|
1821
1931
|
function get_extname(filePath) {
|
|
1822
1932
|
if (!filePath)
|
|
@@ -1854,32 +1964,36 @@ function get_relative_path(basePath, targetPath) {
|
|
|
1854
1964
|
}
|
|
1855
1965
|
}
|
|
1856
1966
|
/**
|
|
1857
|
-
* Join multiple path segments,
|
|
1967
|
+
* Join multiple path segments — clean, predictable, bulletproof.
|
|
1968
|
+
*
|
|
1969
|
+
* Accepts ANYTHING that ensure_list can handle:
|
|
1970
|
+
* • 'a,b,c'
|
|
1971
|
+
* • ['a', 'b,c']
|
|
1972
|
+
* • 'a/b/c'
|
|
1973
|
+
* • '/a/', 'b//c'
|
|
1974
|
+
* • mixed arrays, comma strings, whatever
|
|
1858
1975
|
*
|
|
1859
|
-
*
|
|
1860
|
-
* make_path('/foo','bar','baz')
|
|
1861
|
-
* make_path(['/foo','bar','baz'])
|
|
1976
|
+
* Always returns a clean POSIX path string. Never a list.
|
|
1862
1977
|
*/
|
|
1863
|
-
function make_path(...
|
|
1864
|
-
//
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
let
|
|
1871
|
-
if (
|
|
1872
|
-
|
|
1978
|
+
function make_path(...parts) {
|
|
1979
|
+
// Normalize incoming segments into a flat list
|
|
1980
|
+
const segments = ensure_list(parts).map(x => String(x));
|
|
1981
|
+
let out = "";
|
|
1982
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1983
|
+
const seg = segments[i];
|
|
1984
|
+
// Normalize a segment:
|
|
1985
|
+
let cleaned = eatOuter(seg, "/"); // trim trailing slashes
|
|
1986
|
+
if (!cleaned)
|
|
1987
|
+
continue;
|
|
1988
|
+
if (out === "") {
|
|
1989
|
+
out = cleaned;
|
|
1873
1990
|
}
|
|
1874
1991
|
else {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
// remove any trailing slash on the accumulator
|
|
1878
|
-
real_path = real_path.replace(/\/+$/, '');
|
|
1879
|
-
real_path = `${real_path}/${segment}`;
|
|
1992
|
+
cleaned = eatInner(cleaned, "/"); // trim leading slashes
|
|
1993
|
+
out = `${out}/${cleaned}`;
|
|
1880
1994
|
}
|
|
1881
1995
|
}
|
|
1882
|
-
return
|
|
1996
|
+
return out;
|
|
1883
1997
|
}
|
|
1884
1998
|
function sanitizeFilename(filename) {
|
|
1885
1999
|
return filename
|
|
@@ -1893,7 +2007,7 @@ function sanitizeFilename(filename) {
|
|
|
1893
2007
|
function make_sanitized_path(...paths) {
|
|
1894
2008
|
let real_path = '';
|
|
1895
2009
|
for (let i = 0; i < paths.length; i++) {
|
|
1896
|
-
const sanitized = sanitizeFilename(
|
|
2010
|
+
const sanitized = sanitizeFilename(eatOuter(paths[i], '/'));
|
|
1897
2011
|
if (i === 0) {
|
|
1898
2012
|
real_path = sanitized;
|
|
1899
2013
|
}
|
|
@@ -1911,6 +2025,51 @@ function normalizeUrl(base, p) {
|
|
|
1911
2025
|
// collapse multiple “//” into one, but keep the “://” after protocol
|
|
1912
2026
|
return `${cleanBase}/${cleanPath}`.replace(/([^:])\/{2,}/g, '$1/');
|
|
1913
2027
|
}
|
|
2028
|
+
function pathjoin(...parts) {
|
|
2029
|
+
return make_path(...parts);
|
|
2030
|
+
}
|
|
2031
|
+
function pathJoin(...parts) {
|
|
2032
|
+
return make_path(...parts);
|
|
2033
|
+
}
|
|
2034
|
+
function makepath(...parts) {
|
|
2035
|
+
return make_path(...parts);
|
|
2036
|
+
}
|
|
2037
|
+
function makePath(...parts) {
|
|
2038
|
+
return make_path(...parts);
|
|
2039
|
+
}
|
|
2040
|
+
function path_join(...parts) {
|
|
2041
|
+
return make_path(...parts);
|
|
2042
|
+
}
|
|
2043
|
+
function getSplitext(filePath) {
|
|
2044
|
+
return get_splitext(filePath);
|
|
2045
|
+
}
|
|
2046
|
+
function getsplitext(filePath) {
|
|
2047
|
+
return get_splitext(filePath);
|
|
2048
|
+
}
|
|
2049
|
+
function getextname(filePath) {
|
|
2050
|
+
return get_extname(filePath);
|
|
2051
|
+
}
|
|
2052
|
+
function getExtname(filePath) {
|
|
2053
|
+
return get_extname(filePath);
|
|
2054
|
+
}
|
|
2055
|
+
function getfilename(filePath) {
|
|
2056
|
+
return get_filename(filePath);
|
|
2057
|
+
}
|
|
2058
|
+
function getFilename(filePath) {
|
|
2059
|
+
return get_filename(filePath);
|
|
2060
|
+
}
|
|
2061
|
+
function getbasename(filePath) {
|
|
2062
|
+
return get_basename(filePath);
|
|
2063
|
+
}
|
|
2064
|
+
function getBasename(filePath) {
|
|
2065
|
+
return get_basename(filePath);
|
|
2066
|
+
}
|
|
2067
|
+
function getdirname(filePath) {
|
|
2068
|
+
return get_dirname(filePath);
|
|
2069
|
+
}
|
|
2070
|
+
function getDirname(filePath) {
|
|
2071
|
+
return get_dirname(filePath);
|
|
2072
|
+
}
|
|
1914
2073
|
|
|
1915
2074
|
/**
|
|
1916
2075
|
* Returns the absolute path of the current file.
|
|
@@ -2426,6 +2585,10 @@ exports.assure_array = assure_array;
|
|
|
2426
2585
|
exports.assure_list = assure_list;
|
|
2427
2586
|
exports.assure_number = assure_number;
|
|
2428
2587
|
exports.assure_string = assure_string;
|
|
2588
|
+
exports.assurearray = assurearray;
|
|
2589
|
+
exports.assurelist = assurelist;
|
|
2590
|
+
exports.assurenumber = assurenumber;
|
|
2591
|
+
exports.assurestring = assurestring;
|
|
2429
2592
|
exports.callStorage = callStorage;
|
|
2430
2593
|
exports.callWindowMethod = callWindowMethod;
|
|
2431
2594
|
exports.canonDist = canonDist;
|
|
@@ -2446,9 +2609,12 @@ exports.currentUsernames = currentUsernames;
|
|
|
2446
2609
|
exports.decodeJwt = decodeJwt;
|
|
2447
2610
|
exports.distanceToMeters = distanceToMeters;
|
|
2448
2611
|
exports.eatAll = eatAll;
|
|
2449
|
-
exports.
|
|
2612
|
+
exports.eatElse = eatElse;
|
|
2450
2613
|
exports.eatInner = eatInner;
|
|
2451
2614
|
exports.eatOuter = eatOuter;
|
|
2615
|
+
exports.eatall = eatall;
|
|
2616
|
+
exports.eatinner = eatinner;
|
|
2617
|
+
exports.eatouter = eatouter;
|
|
2452
2618
|
exports.ensureArray = ensureArray;
|
|
2453
2619
|
exports.ensureList = ensureList;
|
|
2454
2620
|
exports.ensureNumber = ensureNumber;
|
|
@@ -2457,6 +2623,10 @@ exports.ensure_array = ensure_array;
|
|
|
2457
2623
|
exports.ensure_list = ensure_list;
|
|
2458
2624
|
exports.ensure_number = ensure_number;
|
|
2459
2625
|
exports.ensure_string = ensure_string;
|
|
2626
|
+
exports.ensurearray = ensurearray;
|
|
2627
|
+
exports.ensurelist = ensurelist;
|
|
2628
|
+
exports.ensurenumber = ensurenumber;
|
|
2629
|
+
exports.ensurestring = ensurestring;
|
|
2460
2630
|
exports.exponential = exponential;
|
|
2461
2631
|
exports.fetchIndexHtml = fetchIndexHtml;
|
|
2462
2632
|
exports.fetchIndexHtmlContainer = fetchIndexHtmlContainer;
|
|
@@ -2485,6 +2655,7 @@ exports.getAlphaNum = getAlphaNum;
|
|
|
2485
2655
|
exports.getAlphas = getAlphas;
|
|
2486
2656
|
exports.getAuthorizationHeader = getAuthorizationHeader;
|
|
2487
2657
|
exports.getBaseDir = getBaseDir;
|
|
2658
|
+
exports.getBasename = getBasename;
|
|
2488
2659
|
exports.getBody = getBody;
|
|
2489
2660
|
exports.getChar = getChar;
|
|
2490
2661
|
exports.getCleanArray = getCleanArray;
|
|
@@ -2493,11 +2664,14 @@ exports.getConfig = getConfig;
|
|
|
2493
2664
|
exports.getConfigContent = getConfigContent;
|
|
2494
2665
|
exports.getConfigVar = getConfigVar;
|
|
2495
2666
|
exports.getDbConfigsPath = getDbConfigsPath;
|
|
2667
|
+
exports.getDirname = getDirname;
|
|
2496
2668
|
exports.getDistDir = getDistDir;
|
|
2497
2669
|
exports.getDocumentProp = getDocumentProp;
|
|
2498
2670
|
exports.getEnvDir = getEnvDir;
|
|
2499
2671
|
exports.getEnvPath = getEnvPath;
|
|
2672
|
+
exports.getExtname = getExtname;
|
|
2500
2673
|
exports.getFetchVars = getFetchVars;
|
|
2674
|
+
exports.getFilename = getFilename;
|
|
2501
2675
|
exports.getFunctionsDir = getFunctionsDir;
|
|
2502
2676
|
exports.getFunctionsUtilsDirectory = getFunctionsUtilsDirectory;
|
|
2503
2677
|
exports.getHeaders = getHeaders;
|
|
@@ -2516,6 +2690,7 @@ exports.getSafeLocalStorage = getSafeLocalStorage;
|
|
|
2516
2690
|
exports.getSafeWindow = getSafeWindow;
|
|
2517
2691
|
exports.getSchemasDirPath = getSchemasDirPath;
|
|
2518
2692
|
exports.getSchemasPath = getSchemasPath;
|
|
2693
|
+
exports.getSplitext = getSplitext;
|
|
2519
2694
|
exports.getSrcDir = getSrcDir;
|
|
2520
2695
|
exports.getSubstring = getSubstring;
|
|
2521
2696
|
exports.getToken = getToken;
|
|
@@ -2539,6 +2714,11 @@ exports.get_window = get_window;
|
|
|
2539
2714
|
exports.get_window_location = get_window_location;
|
|
2540
2715
|
exports.get_window_parts = get_window_parts;
|
|
2541
2716
|
exports.get_window_pathname = get_window_pathname;
|
|
2717
|
+
exports.getbasename = getbasename;
|
|
2718
|
+
exports.getdirname = getdirname;
|
|
2719
|
+
exports.getextname = getextname;
|
|
2720
|
+
exports.getfilename = getfilename;
|
|
2721
|
+
exports.getsplitext = getsplitext;
|
|
2542
2722
|
exports.isFiniteNum = isFiniteNum;
|
|
2543
2723
|
exports.isLoggedIn = isLoggedIn;
|
|
2544
2724
|
exports.isMediaType = isMediaType;
|
|
@@ -2548,13 +2728,18 @@ exports.isTokenExpired = isTokenExpired;
|
|
|
2548
2728
|
exports.isType = isType;
|
|
2549
2729
|
exports.is_media_type = is_media_type;
|
|
2550
2730
|
exports.loadConfig = loadConfig;
|
|
2731
|
+
exports.makePath = makePath;
|
|
2551
2732
|
exports.make_path = make_path;
|
|
2552
2733
|
exports.make_sanitized_path = make_sanitized_path;
|
|
2734
|
+
exports.makepath = makepath;
|
|
2553
2735
|
exports.metersToDistance = metersToDistance;
|
|
2554
2736
|
exports.mpsToSpeed = mpsToSpeed;
|
|
2555
2737
|
exports.normalizeUrl = normalizeUrl;
|
|
2556
2738
|
exports.parseResult = parseResult;
|
|
2739
|
+
exports.pathJoin = pathJoin;
|
|
2740
|
+
exports.path_join = path_join;
|
|
2557
2741
|
exports.path_to_url = path_to_url;
|
|
2742
|
+
exports.pathjoin = pathjoin;
|
|
2558
2743
|
exports.processKeywords = processKeywords;
|
|
2559
2744
|
exports.readJsonFile = readJsonFile;
|
|
2560
2745
|
exports.removeToken = removeToken;
|
|
@@ -2573,9 +2758,11 @@ exports.timeToSeconds = timeToSeconds;
|
|
|
2573
2758
|
exports.toMeters = toMeters;
|
|
2574
2759
|
exports.toSeconds = toSeconds;
|
|
2575
2760
|
exports.truncateString = truncateString;
|
|
2761
|
+
exports.tryEatPrefix = tryEatPrefix;
|
|
2576
2762
|
exports.tryParse = tryParse;
|
|
2577
2763
|
exports.urlJoin = urlJoin;
|
|
2578
2764
|
exports.url_to_path = url_to_path;
|
|
2765
|
+
exports.urljoin = urljoin;
|
|
2579
2766
|
exports.velocityFromMs = velocityFromMs;
|
|
2580
2767
|
exports.velocityToMs = velocityToMs;
|
|
2581
2768
|
//# sourceMappingURL=index.js.map
|