@ztimson/utils 0.26.21 → 0.26.23
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/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/dist/misc.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1110,9 +1110,9 @@ class Database {
|
|
|
1110
1110
|
if (!this.includes(table.name)) {
|
|
1111
1111
|
const newDb = new Database(this.database, [...this.tables, table], (this.version ?? 0) + 1);
|
|
1112
1112
|
conn.close();
|
|
1113
|
-
|
|
1114
|
-
Object.assign(this, newDb);
|
|
1113
|
+
this.connection = newDb.connection;
|
|
1115
1114
|
await this.connection;
|
|
1115
|
+
Object.assign(this, newDb);
|
|
1116
1116
|
}
|
|
1117
1117
|
return this.table(table.name);
|
|
1118
1118
|
});
|
|
@@ -1124,9 +1124,9 @@ class Database {
|
|
|
1124
1124
|
const conn = await this.connection;
|
|
1125
1125
|
const newDb = new Database(this.database, this.tables.filter((t) => t.name != table.name), (this.version ?? 0) + 1);
|
|
1126
1126
|
conn.close();
|
|
1127
|
-
|
|
1128
|
-
Object.assign(this, newDb);
|
|
1127
|
+
this.connection = newDb.connection;
|
|
1129
1128
|
await this.connection;
|
|
1129
|
+
Object.assign(this, newDb);
|
|
1130
1130
|
});
|
|
1131
1131
|
}
|
|
1132
1132
|
includes(name) {
|
|
@@ -1747,6 +1747,11 @@ function fracToDec(frac) {
|
|
|
1747
1747
|
split = split.pop().split("/");
|
|
1748
1748
|
return whole + Number(split[0]) / Number(split[1]);
|
|
1749
1749
|
}
|
|
1750
|
+
function compareVersions(target, vs) {
|
|
1751
|
+
const [tMajor, tMinor, tPatch] = target.split(".").map((v) => +v.replace(/[^0-9]/g, ""));
|
|
1752
|
+
const [vMajor, vMinor, vPatch] = vs.split(".").map((v) => +v.replace(/[^0-9]/g, ""));
|
|
1753
|
+
return tMajor > vMajor || tMinor > vMinor || tPatch > vPatch ? 1 : tMajor < vMajor || tMinor < vMinor || tPatch < vPatch ? -1 : 0;
|
|
1754
|
+
}
|
|
1750
1755
|
function escapeRegex(value) {
|
|
1751
1756
|
return value.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
1752
1757
|
}
|
|
@@ -2330,6 +2335,7 @@ export {
|
|
|
2330
2335
|
camelCase,
|
|
2331
2336
|
caseInsensitiveSort,
|
|
2332
2337
|
clean,
|
|
2338
|
+
compareVersions,
|
|
2333
2339
|
contrast,
|
|
2334
2340
|
createJwt,
|
|
2335
2341
|
dec2Frac,
|