bruce-models 5.2.4 → 5.2.5
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/bruce-models.es5.js +46 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +46 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/bruce-api.js +45 -0
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/types/api/bruce-api.d.ts +5 -0
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1247,6 +1247,51 @@
|
|
|
1247
1247
|
});
|
|
1248
1248
|
});
|
|
1249
1249
|
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Version check that returns true if the version is at least the provided version.
|
|
1252
|
+
* @param version
|
|
1253
|
+
*/
|
|
1254
|
+
IsVersionAtLeast(version) {
|
|
1255
|
+
if (!this.version) {
|
|
1256
|
+
return false;
|
|
1257
|
+
}
|
|
1258
|
+
// Debug.
|
|
1259
|
+
if (typeof this.version == "string" && this.version.toLowerCase().includes("debug")) {
|
|
1260
|
+
return true;
|
|
1261
|
+
}
|
|
1262
|
+
// Bad data.
|
|
1263
|
+
if (!this.version.includes(".")) {
|
|
1264
|
+
return false;
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Compares two arrays of version parts.
|
|
1268
|
+
* Returns -1 if `a` is less than `b`, 1 if `a` is greater than `b`, or 0 if they are equal.
|
|
1269
|
+
* @param a
|
|
1270
|
+
* @param b
|
|
1271
|
+
*/
|
|
1272
|
+
function compareVersions(a, b) {
|
|
1273
|
+
for (let i = 0; i < a.length; i++) {
|
|
1274
|
+
if (a[i] < b[i]) {
|
|
1275
|
+
return -1;
|
|
1276
|
+
}
|
|
1277
|
+
else if (a[i] > b[i]) {
|
|
1278
|
+
return 1;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return 0;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Splits a version string into an array of version parts.
|
|
1285
|
+
* Example format: "1.0.4836".
|
|
1286
|
+
* @param version
|
|
1287
|
+
*/
|
|
1288
|
+
function splitVersion(version) {
|
|
1289
|
+
return version.split(".").map(part => parseInt(part));
|
|
1290
|
+
}
|
|
1291
|
+
const curSplit = splitVersion(this.version);
|
|
1292
|
+
const reqSplit = splitVersion(version);
|
|
1293
|
+
return compareVersions(curSplit, reqSplit) >= 0;
|
|
1294
|
+
}
|
|
1250
1295
|
}
|
|
1251
1296
|
BruceApi.Api = Api$$1;
|
|
1252
1297
|
})(exports.BruceApi || (exports.BruceApi = {}));
|
|
@@ -14275,7 +14320,7 @@
|
|
|
14275
14320
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
14276
14321
|
|
|
14277
14322
|
// This is updated with the package.json version on build.
|
|
14278
|
-
const VERSION = "5.2.
|
|
14323
|
+
const VERSION = "5.2.5";
|
|
14279
14324
|
|
|
14280
14325
|
exports.VERSION = VERSION;
|
|
14281
14326
|
exports.AbstractApi = AbstractApi;
|