Package Exports
- keyword-trie-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (keyword-trie-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
keyword-trie-js
replace keywords base trie thanks for https://github.com/xhlian/keyword
install
npm install --save keyword-trie-jsusage
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***