@theguild/federation-composition
Version:
Open Source Composition library for Apollo Federation
16 lines (15 loc) • 556 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.satisfiesVersionRange = satisfiesVersionRange;
function satisfiesVersionRange(version, range) {
const [sign, ver] = range.split(' ');
const versionInRange = parseFloat(ver.replace('v', ''));
const detectedVersion = parseFloat(version.replace('v', ''));
if (sign === '<') {
return detectedVersion < versionInRange;
}
if (sign === '>') {
return detectedVersion > versionInRange;
}
return detectedVersion >= versionInRange;
}
;