Permalink
Browse files

Add blacklist module to validate a bin

  • Loading branch information...
aron committed May 18, 2012
1 parent d5b704b commit d9989fb16e9a80e9c990b75b9b4a9dafc899c478
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/blacklist.js
View
@@ -0,0 +1,19 @@
+var blacklist = require('./config').blacklist || {};
+
+module.exports.validate = function (bin) {
+ var type, keywords, content, index, length;
+
+ for (type in blacklist) {
+ if (blacklist.hasOwnProperty(type)) {
+ content = bin[type] || '';
+ keywords = blacklist[type] || [];
+
+ for (index = 0, length = keywords.length; index < length; index += 1) {
+ if (content.indexOf(keywords[index]) > -1) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+};

0 comments on commit d9989fb

Please sign in to comment.