0.1.0 • Published 5 years ago

mtrie v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

trie

Use trie to implement 'search array by the specified prefixed-string'.

// Big array
const data = [
  'abc hello',
  'hello world',
  'Wow that'
  // ...
]

// The matching string
const str = 'ab'

// Buid trie tree
const tree = trie.generateTrie(data)

// The matched array
const r = trie.matchString(tree, str)