@atomist/automation-client
Version:
Atomist API for software low-level client
31 lines • 938 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const gitHubPatterns_1 = require("./gitHubPatterns");
/**
* Base parameters for working with repo(s).
* Allows use of regex.
*/
class TargetsParams {
constructor() {
/**
* If we're not tied to a single repo ref, test this RepoRef
* @param {RepoRef} rr
* @return {boolean}
*/
this.test = rr => {
if (this.repoRef) {
const my = this.repoRef;
return my.owner === rr.owner && my.repo === rr.repo;
}
if (this.usesRegex) {
return new RegExp(this.repo).test(rr.repo);
}
return false;
};
}
get usesRegex() {
return !!this.repo && !gitHubPatterns_1.GitHubNameRegExp.pattern.test(this.repo);
}
}
exports.TargetsParams = TargetsParams;
//# sourceMappingURL=TargetsParams.js.map