Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static getTagsDescriptor(projectTags: ITag[], region: IRegion): TagsDescriptor {
if (!projectTags || !projectTags.length) {
return null;
}
Guard.null(region);
const tags = region.tags
.map((tagName) => {
const projectTag = projectTags.find((projectTag) => projectTag.name === tagName);
return projectTag ? new Tag(projectTag.name, projectTag.color) : null;
})
.filter((tag) => tag !== null);
return new TagsDescriptor(tags);
}