fix: allow unicode to be identifiers, fixes #655

This commit is contained in:
Harttle
2023-11-04 21:33:29 +08:00
parent d75ac93390
commit dd7616acb9
8 changed files with 41 additions and 13 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { IDENTIFIER, TYPES } from '../util/character'
import { isWord } from '../util/character'
interface TrieInput<T> {
[key: string]: T
@@ -25,7 +25,7 @@ export function createTrie<T = any> (input: TrieInput<T>): Trie<T> {
const c = name[i]
node[c] = node[c] || {}
if (i === name.length - 1 && (TYPES[name.charCodeAt(i)] & IDENTIFIER)) {
if (i === name.length - 1 && isWord(name[i])) {
node[c].needBoundary = true
}