Kaynağa Gözat

Improve string sanitation for parsing

Ensure strings are properly sanitized before processing.
master
TheoryOfNekomata 9 ay önce
ebeveyn
işleme
bb15edd726
1 değiştirilmiş dosya ile 3 ekleme ve 0 silme
  1. +3
    -0
      packages/core/src/systems/en-US/parse.ts

+ 3
- 0
packages/core/src/systems/en-US/parse.ts Dosyayı Görüntüle

@@ -33,6 +33,9 @@ const FINAL_TOKEN = '' as const;

export const tokenize = (stringValue: string) => (
stringValue
.toLowerCase()
.trim()
.replace(/\s+/, ' ')
.replace(new RegExp(`${TENS_ONES_SEPARATOR}`, 'g'), ' ')
.split(' ')
.filter((maybeToken) => maybeToken.length > 0)


Yükleniyor…
İptal
Kaydet