mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-18 15:18:04 +00:00
20 lines
490 B
JavaScript
20 lines
490 B
JavaScript
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;
|
|
};
|