npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

keyword-trie-js

0.0.7 • Public • Published

keyword-trie-js

replace keywords base trie thanks for https://github.com/xhlian/keyword

install

npm install --save keyword-trie-js

usage

function replaceFunc(replace) {
  return new Array(replace.length).fill('*');
}
 
const TrieTree = require('keyword-trie-js');
const tree = new TrieTree();
const keywords = ['5', '6'];
keywords.forEach(t => tree.add(t));
tree.compile();
const str = '555test661555';
const res = tree.replace(str, replaceFunc);
console.log(res); //print ***test**1***

Keywords

install

npm i keyword-trie-js

Downloadsweekly downloads

8

version

0.0.7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability