badguardhome/client/src/helpers/version.js

18 lines
477 B
JavaScript
Raw Normal View History

/**
* Checks if versions are equal.
* Please note, that this method strips the "v" prefix.
*
* @param left {string} - left version
* @param right {string} - right version
* @return {boolean} true if versions are equal
*/
export const areEqualVersions = (left, right) => {
if (!left || !right) {
return false;
}
const leftVersion = left.replace(/^v/, '');
const rightVersion = right.replace(/^v/, '');
return leftVersion === rightVersion;
};