UNPKG
funnelweb
Version:
latest (0.0.1)
0.0.1
Detect search engine crawlers by their User-Agent strings.
presentcompany/funnelweb
funnelweb
/
index.js
11 lines
(9 loc)
•
284 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
var
regex =
require
(
'./regex'
)
module
.
exports
=
function
funnelweb
(
string
) {
if
(
typeof
string
===
'object'
) {
return
module
.
exports
(
string
.
headers
[
'User-Agent'
] ||
string
.
headers
[
'user-agent'
]) }
string
+=
''
return
!!
string
.
match
(regex) };
module
.
exports
.
regex
= regex