omrilotan / isbot

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

Major Change Interface #225

Closed omrilotan closed 7 months ago

omrilotan commented 7 months ago

This change is meant to reduce the size of the package and improve performance by building the regular expression in build time instead of runtime.

New features

import { <SOMETHING> }  from "isbot";
import Type Description
pattern {RegExp} The regular expression used to identify bots
list {string[]} List of all individual pattern parts
isbotMatch {(userAgent: string): string | null} The substring matched by the regular expression
isbotMatches {(userAgent: string): string[]} All substrings matched by the regular expression
isbotPattern {(userAgent: string): string | null} The regular expression used to identify bot substring in the user agent
isbotPatterns {(userAgent: string): string[]} All regular expressions used to identify bot substrings in the user agent
createIsbot {(pattern: RegExp): (userAgent: string): boolean} Create a custom isbot function