import {Issue} from '../classes/issue'; import {ILabel} from '../interfaces/label'; import {cleanLabel} from './clean-label'; /** * @description * Check if the given label is listed as a label of the given issue * * @param {Readonly} issue A GitHub issue containing some labels * @param {Readonly} label The label to check the presence with * * @return {boolean} Return true when the given label is also in the given issue labels */ export function isLabeled( issue: Readonly, label: Readonly ): boolean { return !!issue.labels.find((issueLabel: Readonly): boolean => { return cleanLabel(label) === cleanLabel(issueLabel.name); }); }