1.0.0 • Published 7 years ago

keyword-filter v1.0.0

Weekly downloads
86
License
MIT
Repository
github
Last release
7 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

7 years ago

0.5.0

9 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago