express-spider-middleware
Advanced tools
Comparing version 1.1.6 to 1.1.7
29
index.js
@@ -29,9 +29,10 @@ const spiders = [ | ||
/DemandbasePublisherAnalyzer/i, | ||
/yeti/i | ||
] | ||
/yeti/i, | ||
/ias-va/i | ||
]; | ||
function isSpider (ua) { | ||
return spiders.some(function (spider) { | ||
return spider.test(ua) | ||
}) | ||
function isSpider(ua) { | ||
return spiders.some(function(spider) { | ||
return spider.test(ua); | ||
}); | ||
} | ||
@@ -42,11 +43,11 @@ | ||
middleware: function (callback) { | ||
return function (req, res, next) { | ||
req.isSpider = isSpider.bind(undefined, req.get('user-agent')) | ||
if(isSpider(req.get('user-agent')) && typeof callback === 'function'){ | ||
callback(req) | ||
middleware: function(callback) { | ||
return function(req, res, next) { | ||
req.isSpider = isSpider.bind(undefined, req.get("user-agent")); | ||
if (isSpider(req.get("user-agent")) && typeof callback === "function") { | ||
callback(req); | ||
} | ||
next() | ||
} | ||
next(); | ||
}; | ||
} | ||
} | ||
}; |
{ | ||
"name": "express-spider-middleware", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "And ExpressJS middleware for detecting search engine crawlers/spiders and handling crawler-specific logic such as additional logging for requests from spiders", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7948
169