Skip to content

Commit 19e6ea5

Browse files
committed
refactor: split description into words to support support swedish letters
Signed-off-by: Mats Johansson <extern.mats.johansson@digg.se>
1 parent b5f2e03 commit 19e6ea5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rulesets/DokRules.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ export class Dok06 extends BaseRuleset {
144144
then = [
145145
{
146146
function: (targetVal: string, _opts: string, paths: string[]) => {
147-
const lowerCaseTargetVal = targetVal.toLowerCase();
148-
const containsEnglish = commonEnglishWords.some((word) => new RegExp(`\\b${word}\\b`).test(lowerCaseTargetVal));
149-
const containsSwedish = commonSwedishWords.some((word) => new RegExp(`\\b${word}\\b`).test(lowerCaseTargetVal));
147+
const lowerCaseDescriptionList = targetVal.toLowerCase().match(/[a-zåäö]+/gi) || [];
148+
149+
const containsEnglish = lowerCaseDescriptionList.some((word) => commonEnglishWords.includes(word));
150+
const containsSwedish = lowerCaseDescriptionList.some((word) => commonSwedishWords.includes(word));
150151

151152
if (!containsEnglish || !containsSwedish) {
152153
return [

0 commit comments

Comments
 (0)