Explorar el Código

Improve string sanitation for parsing

Ensure strings are properly sanitized before processing.
master
TheoryOfNekomata hace 9 meses
padre
commit
bb15edd726
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. +3
    -0
      packages/core/src/systems/en-US/parse.ts

+ 3
- 0
packages/core/src/systems/en-US/parse.ts Ver fichero

@@ -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)


Cargando…
Cancelar
Guardar