@rearguard/is-bot
TypeScript icon, indicating that this package has built-in type declarations

1.9.6 • Public • Published

@rearguard/is-bot.

Installation.

npm i @rearguard/is-bot

Intro.

@rearguard/is-bot is a validator for User-Agent strings, it allows efficiently detecting bots, crawlers and scrappers. This library stays up to date with live data provided by https://www.myip.ms

Usage.

const {isBot} = require('@rearguard/is-bot');

isBot(
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
); // false

isBot(
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
); // => false
isBot(
  'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
); // => true

Benchmarks.

@rearguard/is-bot is fast and intuitive, you can find benchmarks against similar libraries in the /bench folder.

Tests.

yarn test

Package Sidebar

Install

npm i @rearguard/is-bot

Weekly Downloads

123

Version

1.9.6

License

MIT

Unpacked Size

5.1 MB

Total Files

24

Last publish

Collaborators

  • vorillaz