Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function shouldProceedCurrentStep(tags = [], envTags = getEnvTags()) {
const parser = new TagExpressionParser();
try {
const expressionNode = parser.parse(envTags);
const mappedTags = tags.map(tag => tag.name);
return expressionNode.evaluate(mappedTags);
} catch (e) {
/* eslint-disable-next-line no-console */
console.log(`Error parsing tags: '${envTags}'. Message: ${e.message}`);
return false;
}
}
constructor(tagExpression) {
if (tagExpression) {
this.tagExpressionNode = parse(tagExpression || '')
}
}
public match(tags: string[]): boolean {
const expression = parseTagExpression(this.tagExpression)
return expression.evaluate(tags)
}
private matchesTagExpression(pickle: messages.IPickle): boolean {
const expression = parseTagExpression(this.tagExpression)
const tagNames = pickle.tags.map(tag => tag.name)
return expression.evaluate(tagNames)
}
}