insomnia-plugin-valorant
Version:
Adds template tags to Insomnia with Valorant data
28 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasWorkspaceActionsBug = void 0;
function compareSemver(a, b) {
for (let i = 0; i < 3; i++) {
if (a[i] > b[i])
return 1;
if (a[i] < b[i])
return -1;
}
return 0;
}
/**
* Checks if the workspace actions bug ( https://github.com/ArchGPT/insomnium/issues/109 ) is present
* Uses a simple version check against the navigator.userAgent string
* @returns {boolean} True if the bug is present, false otherwise
*/
function hasWorkspaceActionsBug() {
const match = navigator.userAgent.match(/Insomnium\/(\S+)/);
if (match === null)
return false;
const version = match[1].split('-')[0];
const [major, minor, patch] = version.split('.').map(v => parseInt(v));
//TODO update this when the bug is fixed. The bug was last observed in 0.2.3
return compareSemver([major, minor, patch], [0, 2, 3]) <= 0;
}
exports.hasWorkspaceActionsBug = hasWorkspaceActionsBug;
//# sourceMappingURL=has-workspace-actions-bug.js.map