JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q52672F
  • License MIT

replace keywords base trie

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-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***