You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
668 B
14 lines
668 B
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parseVersionPredicate = void 0;
|
|
const error_1 = require("../error");
|
|
function parseVersionPredicate(versionPredicate) {
|
|
const versionPredicateRegex = "^(?<comparator>>=|<=|>|<)?(?<targetSemVer>.*)";
|
|
const matches = versionPredicate.match(versionPredicateRegex);
|
|
if (!matches || !matches.groups.targetSemVer) {
|
|
throw new error_1.FirebaseError("Invalid version predicate.");
|
|
}
|
|
const comparator = matches.groups.comparator || "=";
|
|
return { comparator, targetSemVer: matches.groups.targetSemVer };
|
|
}
|
|
exports.parseVersionPredicate = parseVersionPredicate;
|