textlint-rule-helper
Version:
A helper library for textlint rule.
13 lines (12 loc) • 364 B
text/typescript
/**
* Return true if `types` includes `type`.
* It compares with `===` like `types.some(t => t === type)`, without creating a closure.
*/
export const includesType = (types: readonly string[], type: string): boolean => {
for (let i = 0; i < types.length; i++) {
if (types[i] === type) {
return true;
}
}
return false;
};