omrilotan / isbot

🤖/👨‍🦰 Detect bots/crawlers/spiders using the user agent string
https://isbot.js.org/
The Unlicense
905 stars 74 forks source link

Update UA lists #170

Closed omrilotan closed 2 years ago

omrilotan commented 2 years ago

Add "matches" and "clear" methods used to clear patterns matching a user agent string.

This will be a suitable solution for such cases. The example below includes extra steps to display the journey.

For example:

const ua = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SearchRobot/1.0'

sbot(ua) // true
isbot.find(ua) // 'Search'
isbot.matches(ua) // [ '(?<! cu)bot', '(?<! (ya|yandex))search' ]
isbot.clear(ua)
isbot(ua) // false
isbot.find(ua) // null

Resolve issue #166