SpeakNoEvil:根据短语黑名单检查字符串的 npm 包

  • L7_163847
    了解作者
  • 11.8KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-09 17:58
    上传日期
方法: 在字符串中搜索黑名单中每个单词/短语的子字符串匹配 用法: # create a filter with the default list Filter = new SpeakNoEvil () # create a filter with a custom list Filter = new SpeakNoEvil ([ " a " , " b " , " c " ]) # check a string for profanity result = Filter . check ( " a possibly profane string " ) if result console . log " string was profane " 运行测试 npm install -g grunt mocha npm test
SpeakNoEvil-master.zip
  • SpeakNoEvil-master
  • gruntfile.coffee
    1.4KB
  • speak-no-evil.sublime-project
    70B
  • src
  • SpeakNoEvil.coffee
    6.1KB
  • lib
  • SpeakNoEvil.js
    6.4KB
  • test
  • test.coffee
    5KB
  • README.md
    624B
  • speak-no-evil.sublime-workspace
    13.6KB
  • .gitignore
    535B
  • package.json
    866B
内容介绍
[ ![Codeship Status for NestedData/SpeakNoEvil](https://www.codeship.io/projects/04ee87d0-14be-0132-d27b-7e5e22028118/status)](https://www.codeship.io/projects/33508) ## Methodology: Searches a string for a substring match of each word/phrase in the blacklist ## Usage: ```coffee # create a filter with the default list Filter = new SpeakNoEvil() # create a filter with a custom list Filter = new SpeakNoEvil(["a", "b", "c"]) # check a string for profanity result = Filter.check("a possibly profane string") if result console.log "string was profane" ``` ## Running tests ``` npm install -g grunt mocha npm test ```
评论
    相关推荐