Bug 1391405: Part 4 - Avoid easily-avoidable regexp. r?zombie
MozReview-Commit-ID: 6xAr5hGxm2r
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -1182,17 +1182,17 @@ class Type extends Entry {
// normalize. Subclasses can choose to use it or not.
normalizeBase(type, value, context) {
if (this.checkBaseType(getValueBaseType(value))) {
this.checkDeprecated(context, value);
return {value: this.preprocess(value, context)};
}
let choice;
- if (/^[aeiou]/.test(type)) {
+ if ("aeiou".includes(type[0])) {
choice = `be an ${type} value`;
} else {
choice = `be a ${type} value`;
}
return context.error(() => `Expected ${type} instead of ${JSON.stringify(value)}`,
choice);
}