1.0.0 • Published 4 years ago

keyword-filter v1.0.0

Weekly downloads
86
License
MIT
Repository
github
Last release
4 years ago

NPM version Build status Test coverage License Dependency status

an extreme lightweight keyword filter for node.js

install

npm install keyword-filter

api

  • hasKeyword
  • replaceKeywords
  • getOccurances

example

const KeywordFilter = require('keyword-filter')
const filter = new KeywordFilter()

const keyArrays = ['go', 'js', 'lang', '我哈', '你呀']

filter.init(keyArrays)

const content = 'what is the best lang, go or js?\n' +
  '你呀个妹,咿呀我哈噶'

filter.hasKeyword(content)
filter.replaceKeywords(content, '*')
filter.replaceKeywords(content, 'happy')
filter.getOccurances(content) // -> Returns [{1,'go'},{1,'js'},{1,'lang'}, {2, '我哈'}, {2, '你呀'}]
1.0.0

4 years ago

0.5.0

6 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago