@hot-updater/plugin-core
Version:
React Native OTA solution for self-hosted
17 lines (15 loc) • 742 B
JavaScript
import { semverSatisfies } from "./semverSatisfies.js";
//#region src/filterCompatibleAppVersions.ts
/**
* Filters target app versions that are compatible with the current app version.
* Returns only versions that are compatible with the current version according to semver rules.
*
* @param targetAppVersionList - List of target app versions to filter
* @param currentVersion - Current app version
* @returns Array of target app versions compatible with the current version
*/
const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
return targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));
};
//#endregion
export { filterCompatibleAppVersions };