@todesktop/client-util
Advanced tools
Comparing version 1.0.0-alpha11 to 1.0.0-alpha12
@@ -1,13 +0,3 @@ | ||
const getBackendVersion = () => typeof window["todesktop"] === "object" && | ||
window["todesktop"].desktopifyVersion; | ||
import { isSemverGreaterOrEqualThan } from "./isSemverGreaterOrEqualThan"; | ||
/** | ||
* Parses a simple semver string into a semver object. | ||
* Works with "x.x.x" strings. Does not work with or "x.x.x-x" strings. | ||
* @internal | ||
*/ | ||
function parseSimpleSemVer(version) { | ||
const [major, minor, patch] = version.split(".").map(Number); | ||
return { major, minor, patch }; | ||
} | ||
/** | ||
* Checks if a desktopify api version is compatible with the current version of the desktopify backend | ||
@@ -24,31 +14,3 @@ * @internal | ||
} | ||
/** | ||
* Checks if a semver is greater or equal than another semver. | ||
* Works with "x.x.x" strings. Does not work with or "x.x.x-x" strings. | ||
* @internal | ||
*/ | ||
function isSemverGreaterOrEqualThan(currentVersion, versionFeatureIntroduced) { | ||
const curr = parseSimpleSemVer(currentVersion); | ||
const introduced = parseSimpleSemVer(versionFeatureIntroduced); | ||
if (curr.major > introduced.major) { | ||
return true; | ||
} | ||
else if (curr.major < introduced.major) { | ||
return false; | ||
} | ||
else if (curr.minor > introduced.minor) { | ||
return true; | ||
} | ||
else if (curr.minor < introduced.minor) { | ||
return false; | ||
} | ||
else if (curr.patch > introduced.patch) { | ||
return true; | ||
} | ||
else if (curr.patch < introduced.patch) { | ||
return false; | ||
} | ||
else { | ||
return true; | ||
} | ||
} | ||
const getBackendVersion = () => typeof window["todesktop"] === "object" && | ||
window["todesktop"].desktopifyVersion; |
@@ -31,2 +31,3 @@ /** | ||
BrowserView: BrowserView; | ||
process: NodeJS.Process; | ||
} | ||
@@ -180,1 +181,2 @@ export interface NamespacesStaticV1 { | ||
export { checkIfCompatibleWithBackend } from "./checkIfCompatibleWithBackend.js"; | ||
export { checkIfCompatibleWithPlugin } from "./checkIfCompatibleWithPlugin.js"; |
@@ -64,1 +64,2 @@ /** | ||
export { checkIfCompatibleWithBackend } from "./checkIfCompatibleWithBackend.js"; | ||
export { checkIfCompatibleWithPlugin } from "./checkIfCompatibleWithPlugin.js"; |
{ | ||
"name": "@todesktop/client-util", | ||
"version": "1.0.0-alpha11", | ||
"version": "1.0.0-alpha12", | ||
"description": "Utility functions for ToDesktop client libraries", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20177
15
494