keyword-filter

keyword filter for node.js

npm install keyword-filter
14 downloads in the last week
25 downloads in the last month

NPM

a extreme lightweight keyword filter for node.js

install

npm install keyword-filter

api

  • hasKeyWord
  • replaceKeyWordWithChar
  • replaceKeyWordWithString

example

var keywordFilter = require('keyword-filter')

var keyArrays = ['go', 'js', 'lang', '我哈', '你呀']
keywordFilter.init(keyArrays)

var testContents = 'what is the best lang, go or js?你呀个妹,咿呀我哈噶'

keywordFilter.hasKeyWord(testContents)
keywordFilter.replaceKeyWordWithChar(testContents, '*')
keywordFilter.replaceKeyWordWithString(testContents, 'happy')

test coverage: 98%

npm loves you