Skip to content

Commit 7cd7688

Browse files
committed
feat: remove obsolete translations, rename function
Signed-off-by: Mats Johansson <extern.mats.johansson@digg.se>
1 parent aca3b69 commit 7cd7688

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/rulesets/DokRules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { DiagnosticSeverity } from '@stoplight/types';
99
import { Dok03Base } from './rulesetUtil.js';
1010
import { Dok15Base } from './rulesetUtil.js';
1111
import { commonEnglishWords, commonSwedishWords } from './constants/CommonWords.js';
12-
import * as chrono from 'chrono-node';
1312
import { containsDate } from './util/DokRulesUtil.js';
1413
const moduleName: string = 'DokRules.js';
1514

src/rulesets/util/DokRulesUtil.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import * as chrono from 'chrono-node';
66

7-
export const translateToEnglish = (text: string): string => {
7+
export const translateMonthsToEnglish = (text: string): string => {
88
return text
99
.replace(/\bjan(uari)?\b/gi, 'January')
1010
.replace(/\bfeb(ruari)?\b/gi, 'February')
@@ -17,18 +17,14 @@ export const translateToEnglish = (text: string): string => {
1717
.replace(/\bsep(tember)?\b/gi, 'September')
1818
.replace(/\bokt(ober)?\b/gi, 'October')
1919
.replace(/\bnov(ember)?\b/gi, 'November')
20-
.replace(/\bdec(ember)?\b/gi, 'December')
21-
.replace(/\bidag\b/gi, 'today')
22-
.replace(/\bimorgon\b/gi, 'tomorrow')
23-
.replace(/\b(igår|i går)\b/gi, 'yesterday')
24-
.replace(/\bnästa\b/gi, 'next');
20+
.replace(/\bdec(ember)?\b/gi, 'December');
2521
};
2622

2723
export const containsDate = (input: string): boolean => {
2824
if (typeof input !== 'string') {
2925
return false;
3026
}
31-
const translatedInput = translateToEnglish(input);
27+
const translatedInput = translateMonthsToEnglish(input);
3228
const results = chrono.parseDate(translatedInput);
3329
if (results != null) {
3430
return true;

0 commit comments

Comments
 (0)