Make label comparison case insensitive (#517)

* Make label comparison case insensitive

* PR Feedback
This commit is contained in:
Luke Tomlinson
2021-07-12 13:56:58 -04:00
committed by GitHub
parent d901397e11
commit a78d0b721e
4 changed files with 70 additions and 108 deletions

View File

@@ -0,0 +1,14 @@
import deburr from 'lodash.deburr';
import { CleanLabel } from '../types/clean-label';
/**
* @description
* Clean a label by lowercasing it and deburring it for consistency
*
* @param {string} label A raw GitHub label
*
* @return {string} A lowercased, deburred version of the passed in label
*/
export function cleanLabel(label: Readonly<string>): CleanLabel {
return deburr(label.toLowerCase());
}

View File

@@ -1,7 +1,6 @@
import deburr from 'lodash.deburr';
import {Issue} from '../classes/issue';
import {ILabel} from '../interfaces/label';
import {CleanLabel} from '../types/clean-label';
import {cleanLabel} from './clean-label';
/**
* @description
@@ -20,7 +19,3 @@ export function isLabeled(
return cleanLabel(label) === cleanLabel(issueLabel.name);
});
}
function cleanLabel(label: Readonly<string>): CleanLabel {
return deburr(label.toLowerCase());
}