@putkoff/abstract-utilities 1.0.23 → 1.0.25
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 +273 -129
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +235 -130
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +42 -1
- 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 +0 -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 +30 -0
- package/dist/types/functions/math_utils/conversions.d.ts +6 -0
- package/dist/types/functions/math_utils/index.d.ts +2 -0
- package/dist/types/functions/math_utils/safe_math.d.ts +1 -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 +0 -0
- 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 +2 -0
- 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 +0 -0
- 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/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
|
@@ -1193,135 +1193,6 @@ posix.posix = posix;
|
|
|
1193
1193
|
|
|
1194
1194
|
var pathBrowserify = posix;
|
|
1195
1195
|
|
|
1196
|
-
function getSubstring(obj, maxLength = null, minLength = null) {
|
|
1197
|
-
const objLength = obj.length;
|
|
1198
|
-
const effectiveMaxLength = maxLength !== null && maxLength !== void 0 ? maxLength : objLength; // Use nullish coalescing for clarity
|
|
1199
|
-
const effectiveMinLength = minLength !== null && minLength !== void 0 ? minLength : 0;
|
|
1200
|
-
// Ensure bounds are valid
|
|
1201
|
-
const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
|
|
1202
|
-
const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
|
|
1203
|
-
// If minLength exceeds maxLength, return empty string or adjust logic as needed
|
|
1204
|
-
if (clampedMinLength >= clampedMaxLength) {
|
|
1205
|
-
return '';
|
|
1206
|
-
}
|
|
1207
|
-
return obj.substring(clampedMinLength, clampedMaxLength);
|
|
1208
|
-
}
|
|
1209
|
-
function truncateString(obj, maxLength = 20) {
|
|
1210
|
-
const objLength = obj.length;
|
|
1211
|
-
if (objLength > maxLength && maxLength) {
|
|
1212
|
-
obj = getSubstring(obj, maxLength) + '...';
|
|
1213
|
-
}
|
|
1214
|
-
return obj;
|
|
1215
|
-
}
|
|
1216
|
-
// string_utils/src/string_utils.ts
|
|
1217
|
-
function stripPrefixes(str, bases = []) {
|
|
1218
|
-
/* NEW: coerce whatever arrives into a string */
|
|
1219
|
-
str = String(str);
|
|
1220
|
-
const prefixes = (Array.isArray(bases) ? bases : [bases])
|
|
1221
|
-
.filter(Boolean)
|
|
1222
|
-
.sort((a, b) => b.length - a.length); // longest first
|
|
1223
|
-
let changed = true;
|
|
1224
|
-
while (changed) {
|
|
1225
|
-
changed = false;
|
|
1226
|
-
for (const prefix of prefixes) {
|
|
1227
|
-
if (str.startsWith(prefix)) {
|
|
1228
|
-
str = str.slice(prefix.length);
|
|
1229
|
-
changed = true;
|
|
1230
|
-
break; // restart from longest prefix
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
return str;
|
|
1235
|
-
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Removes characters from the beginning of the string
|
|
1238
|
-
* if they are found in the list of characters.
|
|
1239
|
-
*
|
|
1240
|
-
* @param str - The input string.
|
|
1241
|
-
* @param listObjects - A string or an array of characters to remove.
|
|
1242
|
-
* @returns The modified string.
|
|
1243
|
-
*/
|
|
1244
|
-
function eatInner(str, listObjects) {
|
|
1245
|
-
if (!Array.isArray(listObjects)) {
|
|
1246
|
-
listObjects = [listObjects];
|
|
1247
|
-
}
|
|
1248
|
-
// Ensure str is a string
|
|
1249
|
-
str = String(str);
|
|
1250
|
-
// Remove characters from the beginning while they are in listObjects
|
|
1251
|
-
while (str.length > 0 && listObjects.includes(str[0])) {
|
|
1252
|
-
str = str.slice(1);
|
|
1253
|
-
}
|
|
1254
|
-
return str;
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Removes characters from the end of the string
|
|
1258
|
-
* if they are found in the list of characters.
|
|
1259
|
-
*
|
|
1260
|
-
* @param str - The input string.
|
|
1261
|
-
* @param listObjects - A string or an array of characters to remove.
|
|
1262
|
-
* @returns The modified string.
|
|
1263
|
-
*/
|
|
1264
|
-
function eatOuter(str, listObjects) {
|
|
1265
|
-
if (!Array.isArray(listObjects)) {
|
|
1266
|
-
listObjects = [listObjects];
|
|
1267
|
-
}
|
|
1268
|
-
// Ensure str is a string
|
|
1269
|
-
str = String(str);
|
|
1270
|
-
// Remove characters from the end while they are in listObjects
|
|
1271
|
-
while (str.length > 0 && listObjects.includes(str[str.length - 1])) {
|
|
1272
|
-
str = str.slice(0, -1);
|
|
1273
|
-
}
|
|
1274
|
-
return str;
|
|
1275
|
-
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Removes characters from both the beginning and the end of the string
|
|
1278
|
-
* if they are found in the list of characters.
|
|
1279
|
-
*
|
|
1280
|
-
* @param str - The input string.
|
|
1281
|
-
* @param listObjects - A string or an array of characters to remove.
|
|
1282
|
-
* @returns The modified string.
|
|
1283
|
-
*/
|
|
1284
|
-
function eatAll(str, listObjects) {
|
|
1285
|
-
return eatOuter(eatInner(str, listObjects), listObjects);
|
|
1286
|
-
}
|
|
1287
|
-
function eatEnd(obj, endings = ['/']) {
|
|
1288
|
-
let result = obj;
|
|
1289
|
-
let modified = true;
|
|
1290
|
-
while (modified) {
|
|
1291
|
-
modified = false;
|
|
1292
|
-
for (const ending of endings) {
|
|
1293
|
-
if (result.endsWith(ending)) {
|
|
1294
|
-
result = result.slice(0, -ending.length);
|
|
1295
|
-
modified = true;
|
|
1296
|
-
break;
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
return result;
|
|
1301
|
-
}
|
|
1302
|
-
function tryParse(obj) {
|
|
1303
|
-
try {
|
|
1304
|
-
obj = JSON.stringify(obj);
|
|
1305
|
-
}
|
|
1306
|
-
catch (err) {
|
|
1307
|
-
try {
|
|
1308
|
-
obj = JSON.parse(obj);
|
|
1309
|
-
}
|
|
1310
|
-
catch (err) {
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
return obj;
|
|
1314
|
-
}
|
|
1315
|
-
function create_list_string(array_obj) {
|
|
1316
|
-
let string = '';
|
|
1317
|
-
for (const obj in array_obj) {
|
|
1318
|
-
const array_value = array_obj[obj];
|
|
1319
|
-
const parsed_value = tryParse(array_value);
|
|
1320
|
-
string += `${obj} == ${parsed_value}\n`;
|
|
1321
|
-
}
|
|
1322
|
-
return string;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
1196
|
function ensure_list(obj) {
|
|
1326
1197
|
const objArray = Array.isArray(obj) ? obj : [obj];
|
|
1327
1198
|
return objArray;
|
|
@@ -1762,6 +1633,159 @@ const confirm_type = confirmType;
|
|
|
1762
1633
|
const is_media_type = isMediaType;
|
|
1763
1634
|
const get_mime_type = getMimeType;
|
|
1764
1635
|
|
|
1636
|
+
function getSubstring(obj, maxLength = null, minLength = null) {
|
|
1637
|
+
const objLength = obj.length;
|
|
1638
|
+
const effectiveMaxLength = maxLength !== null && maxLength !== void 0 ? maxLength : objLength; // Use nullish coalescing for clarity
|
|
1639
|
+
const effectiveMinLength = minLength !== null && minLength !== void 0 ? minLength : 0;
|
|
1640
|
+
// Ensure bounds are valid
|
|
1641
|
+
const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
|
|
1642
|
+
const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
|
|
1643
|
+
// If minLength exceeds maxLength, return empty string or adjust logic as needed
|
|
1644
|
+
if (clampedMinLength >= clampedMaxLength) {
|
|
1645
|
+
return '';
|
|
1646
|
+
}
|
|
1647
|
+
return obj.substring(clampedMinLength, clampedMaxLength);
|
|
1648
|
+
}
|
|
1649
|
+
function truncateString(obj, maxLength = 20) {
|
|
1650
|
+
const objLength = obj.length;
|
|
1651
|
+
if (objLength > maxLength && maxLength) {
|
|
1652
|
+
obj = getSubstring(obj, maxLength) + '...';
|
|
1653
|
+
}
|
|
1654
|
+
return obj;
|
|
1655
|
+
}
|
|
1656
|
+
function capitalize_str(string) {
|
|
1657
|
+
string = assureString(string);
|
|
1658
|
+
const string_len = string.length;
|
|
1659
|
+
let init_char = string.toUpperCase();
|
|
1660
|
+
if (string_len > 0) {
|
|
1661
|
+
init_char = string[0].toUpperCase();
|
|
1662
|
+
}
|
|
1663
|
+
let rest_chars = '';
|
|
1664
|
+
if (string_len > 1) {
|
|
1665
|
+
rest_chars = string.slice(1).toLowerCase();
|
|
1666
|
+
}
|
|
1667
|
+
const fin_chars = `${init_char}${rest_chars}`;
|
|
1668
|
+
return fin_chars;
|
|
1669
|
+
}
|
|
1670
|
+
function capitalize(string) {
|
|
1671
|
+
let nu_string = '';
|
|
1672
|
+
string = assureString(string);
|
|
1673
|
+
let objs = string.replace('-', '_').split('_');
|
|
1674
|
+
for (const obj of objs) {
|
|
1675
|
+
let str_obj = capitalize_str(obj);
|
|
1676
|
+
nu_string = `${nu_string} ${str_obj}`;
|
|
1677
|
+
}
|
|
1678
|
+
return eatAll(nu_string, [' ']);
|
|
1679
|
+
}
|
|
1680
|
+
// string_utils/src/string_utils.ts
|
|
1681
|
+
function stripPrefixes(str, bases = []) {
|
|
1682
|
+
/* NEW: coerce whatever arrives into a string */
|
|
1683
|
+
str = String(str);
|
|
1684
|
+
const prefixes = (Array.isArray(bases) ? bases : [bases])
|
|
1685
|
+
.filter(Boolean)
|
|
1686
|
+
.sort((a, b) => b.length - a.length); // longest first
|
|
1687
|
+
let changed = true;
|
|
1688
|
+
while (changed) {
|
|
1689
|
+
changed = false;
|
|
1690
|
+
for (const prefix of prefixes) {
|
|
1691
|
+
if (str.startsWith(prefix)) {
|
|
1692
|
+
str = str.slice(prefix.length);
|
|
1693
|
+
changed = true;
|
|
1694
|
+
break; // restart from longest prefix
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
return str;
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Removes characters from the beginning of the string
|
|
1702
|
+
* if they are found in the list of characters.
|
|
1703
|
+
*
|
|
1704
|
+
* @param str - The input string.
|
|
1705
|
+
* @param listObjects - A string or an array of characters to remove.
|
|
1706
|
+
* @returns The modified string.
|
|
1707
|
+
*/
|
|
1708
|
+
function eatInner(str, listObjects) {
|
|
1709
|
+
if (!Array.isArray(listObjects)) {
|
|
1710
|
+
listObjects = [listObjects];
|
|
1711
|
+
}
|
|
1712
|
+
// Ensure str is a string
|
|
1713
|
+
str = String(str);
|
|
1714
|
+
// Remove characters from the beginning while they are in listObjects
|
|
1715
|
+
while (str.length > 0 && listObjects.includes(str[0])) {
|
|
1716
|
+
str = str.slice(1);
|
|
1717
|
+
}
|
|
1718
|
+
return str;
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* Removes characters from the end of the string
|
|
1722
|
+
* if they are found in the list of characters.
|
|
1723
|
+
*
|
|
1724
|
+
* @param str - The input string.
|
|
1725
|
+
* @param listObjects - A string or an array of characters to remove.
|
|
1726
|
+
* @returns The modified string.
|
|
1727
|
+
*/
|
|
1728
|
+
function eatOuter(str, listObjects) {
|
|
1729
|
+
if (!Array.isArray(listObjects)) {
|
|
1730
|
+
listObjects = [listObjects];
|
|
1731
|
+
}
|
|
1732
|
+
// Ensure str is a string
|
|
1733
|
+
str = String(str);
|
|
1734
|
+
// Remove characters from the end while they are in listObjects
|
|
1735
|
+
while (str.length > 0 && listObjects.includes(str[str.length - 1])) {
|
|
1736
|
+
str = str.slice(0, -1);
|
|
1737
|
+
}
|
|
1738
|
+
return str;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Removes characters from both the beginning and the end of the string
|
|
1742
|
+
* if they are found in the list of characters.
|
|
1743
|
+
*
|
|
1744
|
+
* @param str - The input string.
|
|
1745
|
+
* @param listObjects - A string or an array of characters to remove.
|
|
1746
|
+
* @returns The modified string.
|
|
1747
|
+
*/
|
|
1748
|
+
function eatAll(str, listObjects) {
|
|
1749
|
+
return eatOuter(eatInner(str, listObjects), listObjects);
|
|
1750
|
+
}
|
|
1751
|
+
function eatEnd(obj, endings = ['/']) {
|
|
1752
|
+
let result = obj;
|
|
1753
|
+
let modified = true;
|
|
1754
|
+
while (modified) {
|
|
1755
|
+
modified = false;
|
|
1756
|
+
for (const ending of endings) {
|
|
1757
|
+
if (result.endsWith(ending)) {
|
|
1758
|
+
result = result.slice(0, -ending.length);
|
|
1759
|
+
modified = true;
|
|
1760
|
+
break;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
return result;
|
|
1765
|
+
}
|
|
1766
|
+
function tryParse(obj) {
|
|
1767
|
+
try {
|
|
1768
|
+
obj = JSON.stringify(obj);
|
|
1769
|
+
}
|
|
1770
|
+
catch (err) {
|
|
1771
|
+
try {
|
|
1772
|
+
obj = JSON.parse(obj);
|
|
1773
|
+
}
|
|
1774
|
+
catch (err) {
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
return obj;
|
|
1778
|
+
}
|
|
1779
|
+
function create_list_string(array_obj) {
|
|
1780
|
+
let string = '';
|
|
1781
|
+
for (const obj in array_obj) {
|
|
1782
|
+
const array_value = array_obj[obj];
|
|
1783
|
+
const parsed_value = tryParse(array_value);
|
|
1784
|
+
string += `${obj} == ${parsed_value}\n`;
|
|
1785
|
+
}
|
|
1786
|
+
return string;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1765
1789
|
/**
|
|
1766
1790
|
* In the browser we already have a WHATWG URL constructor on window.
|
|
1767
1791
|
* Here we re-export it as “url” so other modules can import it.
|
|
@@ -1995,6 +2019,87 @@ function roundPercentage(x) {
|
|
|
1995
2019
|
const pct = safeMultiply(ensure_number(x), 100);
|
|
1996
2020
|
return safeDivide(Math.round(pct), 100);
|
|
1997
2021
|
}
|
|
2022
|
+
function exponential(i, k) {
|
|
2023
|
+
return i * (10 ** (k));
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
const SECOND = 1;
|
|
2027
|
+
const ZEPTOSECOND = exponential(SECOND, -21);
|
|
2028
|
+
const ATTOSECOND = exponential(SECOND, -18);
|
|
2029
|
+
const FEMTOSECOND = exponential(SECOND, -15);
|
|
2030
|
+
const PICOSECOND = exponential(SECOND, -12);
|
|
2031
|
+
const NANOSECOND = exponential(SECOND, -9);
|
|
2032
|
+
const MICROSECOND = exponential(SECOND, -6);
|
|
2033
|
+
const MILISECOND = exponential(SECOND, -3);
|
|
2034
|
+
const CENTISECOND = exponential(SECOND, -2);
|
|
2035
|
+
const DECISECOND = exponential(SECOND, -1);
|
|
2036
|
+
const MINUTE = SECOND * 60;
|
|
2037
|
+
const HOUR = MINUTE * 60;
|
|
2038
|
+
const DAY = HOUR * 24;
|
|
2039
|
+
const YEAR = DAY * 365;
|
|
2040
|
+
const MONTH = YEAR / 12;
|
|
2041
|
+
//math
|
|
2042
|
+
const PI = Math.PI;
|
|
2043
|
+
const PI2 = 2 * PI;
|
|
2044
|
+
const M_IN_KM = 1000;
|
|
2045
|
+
const M_IN_MI = 1609.34;
|
|
2046
|
+
const M_IN_FT = 0.3048;
|
|
2047
|
+
const KM_IN_M = 1 / M_IN_KM;
|
|
2048
|
+
const MI_IN_M = 1 / M_IN_MI;
|
|
2049
|
+
const FT_IN_M = 1 / M_IN_FT;
|
|
2050
|
+
const MIN_IN_S = 1 / MINUTE;
|
|
2051
|
+
const HOUR_IN_S = 1 / HOUR;
|
|
2052
|
+
const DAY_IN_S = 1 / DAY;
|
|
2053
|
+
const YEAR_IN_S = 1 / YEAR;
|
|
2054
|
+
const MONTH_IN_S = 1 / MONTH;
|
|
2055
|
+
const MiPerH_TO_MPerS = M_IN_MI * HOUR_IN_S;
|
|
2056
|
+
const MPerS_TO_MiPerH = 1 / MiPerH_TO_MPerS;
|
|
2057
|
+
|
|
2058
|
+
const toMeters = (v, unit) => {
|
|
2059
|
+
switch (unit) {
|
|
2060
|
+
case 'km': return v * M_IN_KM;
|
|
2061
|
+
case 'mi': return v * M_IN_MI;
|
|
2062
|
+
case 'ft': return v * M_IN_FT;
|
|
2063
|
+
default: return v;
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
const toSeconds = (v, unit) => {
|
|
2067
|
+
switch (unit) {
|
|
2068
|
+
case 'min': return v * MINUTE;
|
|
2069
|
+
case 'h': return v * HOUR;
|
|
2070
|
+
case 'day': return v * DAY;
|
|
2071
|
+
default: return v;
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
const fromMeters = (d, unit) => {
|
|
2075
|
+
switch (unit) {
|
|
2076
|
+
case 'km': return d * KM_IN_M;
|
|
2077
|
+
case 'mi': return d * MI_IN_M;
|
|
2078
|
+
case 'ft': return d * FT_IN_M;
|
|
2079
|
+
default: return d;
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
const velocityToMs = (value, unit) => {
|
|
2083
|
+
switch (unit) {
|
|
2084
|
+
case 'km/s': return value * M_IN_KM;
|
|
2085
|
+
case 'mph': return value * MiPerH_TO_MPerS; // 1 mph = 0.44704 m/s
|
|
2086
|
+
case 'ft/s': return value * M_IN_FT; // 1 ft/s = 0.3048 m/s
|
|
2087
|
+
default: return value; // m/s
|
|
2088
|
+
}
|
|
2089
|
+
};
|
|
2090
|
+
const velocityFromMs = (value, unit) => {
|
|
2091
|
+
switch (unit) {
|
|
2092
|
+
case 'km/s': return value * KM_IN_M;
|
|
2093
|
+
case 'mph': return value * MPerS_TO_MiPerH;
|
|
2094
|
+
case 'ft/s': return value * FT_IN_M;
|
|
2095
|
+
default: return value;
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
const fromMps = (v, dist_unit, time_unit) => {
|
|
2099
|
+
const dist_conv = toMeters(1, dist_unit);
|
|
2100
|
+
const time_conv = toSeconds(1, time_unit);
|
|
2101
|
+
return v * (time_conv / dist_conv);
|
|
2102
|
+
};
|
|
1998
2103
|
|
|
1999
2104
|
function Button(_a) {
|
|
2000
2105
|
var { children, color = 'gray', variant = 'default', className = '' } = _a, rest = __rest(_a, ["children", "color", "variant", "className"]);
|
|
@@ -2156,18 +2261,48 @@ Object.defineProperty(exports, "useState", {
|
|
|
2156
2261
|
get: function () { return react.useState; }
|
|
2157
2262
|
});
|
|
2158
2263
|
exports.API_PREFIX = API_PREFIX;
|
|
2264
|
+
exports.ATTOSECOND = ATTOSECOND;
|
|
2159
2265
|
exports.BASE_URL = BASE_URL;
|
|
2160
2266
|
exports.Button = Button;
|
|
2267
|
+
exports.CENTISECOND = CENTISECOND;
|
|
2161
2268
|
exports.Checkbox = Checkbox;
|
|
2269
|
+
exports.DAY = DAY;
|
|
2270
|
+
exports.DAY_IN_S = DAY_IN_S;
|
|
2271
|
+
exports.DECISECOND = DECISECOND;
|
|
2162
2272
|
exports.DEV_PREFIX = DEV_PREFIX;
|
|
2163
2273
|
exports.DOMAIN_NAME = DOMAIN_NAME;
|
|
2274
|
+
exports.FEMTOSECOND = FEMTOSECOND;
|
|
2275
|
+
exports.FT_IN_M = FT_IN_M;
|
|
2276
|
+
exports.HOUR = HOUR;
|
|
2277
|
+
exports.HOUR_IN_S = HOUR_IN_S;
|
|
2164
2278
|
exports.Input = Input;
|
|
2279
|
+
exports.KM_IN_M = KM_IN_M;
|
|
2165
2280
|
exports.MEDIA_TYPES = MEDIA_TYPES;
|
|
2281
|
+
exports.MICROSECOND = MICROSECOND;
|
|
2282
|
+
exports.MILISECOND = MILISECOND;
|
|
2166
2283
|
exports.MIME_TYPES = MIME_TYPES;
|
|
2284
|
+
exports.MINUTE = MINUTE;
|
|
2285
|
+
exports.MIN_IN_S = MIN_IN_S;
|
|
2286
|
+
exports.MI_IN_M = MI_IN_M;
|
|
2287
|
+
exports.MONTH = MONTH;
|
|
2288
|
+
exports.MONTH_IN_S = MONTH_IN_S;
|
|
2289
|
+
exports.MPerS_TO_MiPerH = MPerS_TO_MiPerH;
|
|
2290
|
+
exports.M_IN_FT = M_IN_FT;
|
|
2291
|
+
exports.M_IN_KM = M_IN_KM;
|
|
2292
|
+
exports.M_IN_MI = M_IN_MI;
|
|
2293
|
+
exports.MiPerH_TO_MPerS = MiPerH_TO_MPerS;
|
|
2294
|
+
exports.NANOSECOND = NANOSECOND;
|
|
2295
|
+
exports.PI = PI;
|
|
2296
|
+
exports.PI2 = PI2;
|
|
2297
|
+
exports.PICOSECOND = PICOSECOND;
|
|
2167
2298
|
exports.PROD_PREFIX = PROD_PREFIX;
|
|
2168
2299
|
exports.PROTOCOL = PROTOCOL;
|
|
2300
|
+
exports.SECOND = SECOND;
|
|
2169
2301
|
exports.SUB_DIR = SUB_DIR;
|
|
2170
2302
|
exports.Spinner = Spinner;
|
|
2303
|
+
exports.YEAR = YEAR;
|
|
2304
|
+
exports.YEAR_IN_S = YEAR_IN_S;
|
|
2305
|
+
exports.ZEPTOSECOND = ZEPTOSECOND;
|
|
2171
2306
|
exports.alertit = alertit;
|
|
2172
2307
|
exports.assureArray = assureArray;
|
|
2173
2308
|
exports.assureList = assureList;
|
|
@@ -2179,6 +2314,8 @@ exports.assure_number = assure_number;
|
|
|
2179
2314
|
exports.assure_string = assure_string;
|
|
2180
2315
|
exports.callStorage = callStorage;
|
|
2181
2316
|
exports.callWindowMethod = callWindowMethod;
|
|
2317
|
+
exports.capitalize = capitalize;
|
|
2318
|
+
exports.capitalize_str = capitalize_str;
|
|
2182
2319
|
exports.checkResponse = checkResponse;
|
|
2183
2320
|
exports.cleanArray = cleanArray;
|
|
2184
2321
|
exports.cleanText = cleanText;
|
|
@@ -2200,10 +2337,13 @@ exports.ensure_array = ensure_array;
|
|
|
2200
2337
|
exports.ensure_list = ensure_list;
|
|
2201
2338
|
exports.ensure_number = ensure_number;
|
|
2202
2339
|
exports.ensure_string = ensure_string;
|
|
2340
|
+
exports.exponential = exponential;
|
|
2203
2341
|
exports.fetchIndexHtml = fetchIndexHtml;
|
|
2204
2342
|
exports.fetchIndexHtmlContainer = fetchIndexHtmlContainer;
|
|
2205
2343
|
exports.fetchIt = fetchIt;
|
|
2206
2344
|
exports.formatNumber = formatNumber;
|
|
2345
|
+
exports.fromMeters = fromMeters;
|
|
2346
|
+
exports.fromMps = fromMps;
|
|
2207
2347
|
exports.geAuthsUtilsDirectory = geAuthsUtilsDirectory;
|
|
2208
2348
|
exports.geBackupsUtilsDirectory = geBackupsUtilsDirectory;
|
|
2209
2349
|
exports.geConstantsUtilsDirectory = geConstantsUtilsDirectory;
|
|
@@ -2301,8 +2441,12 @@ exports.safeNums = safeNums;
|
|
|
2301
2441
|
exports.safeStorage = safeStorage;
|
|
2302
2442
|
exports.sanitizeFilename = sanitizeFilename;
|
|
2303
2443
|
exports.stripPrefixes = stripPrefixes;
|
|
2444
|
+
exports.toMeters = toMeters;
|
|
2445
|
+
exports.toSeconds = toSeconds;
|
|
2304
2446
|
exports.truncateString = truncateString;
|
|
2305
2447
|
exports.tryParse = tryParse;
|
|
2306
2448
|
exports.urlJoin = urlJoin;
|
|
2307
2449
|
exports.url_to_path = url_to_path;
|
|
2450
|
+
exports.velocityFromMs = velocityFromMs;
|
|
2451
|
+
exports.velocityToMs = velocityToMs;
|
|
2308
2452
|
//# sourceMappingURL=index.js.map
|