tessl install tessl/npm-isbot@5.1.0Recognise bots/crawlers/spiders using the user agent string.
Agent Success
Agent success rate when using this tile
82%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.94x
Baseline
Agent success rate without this tile
87%
Build utilities that let callers create lightweight bot detectors from custom patterns using the bot-detection dependency.
createBotDetector accepts a regex string "CrawlerX|TestBot" and returns a detector returning true for "Mozilla/5.0 TestBot/1.0" and false for "Mozilla/5.0 Safari/537.36". @testRegExp object works the same way, matching the provided pattern against the user agent. @testcreateDetectorFromList accepts ["FooBot","ScanAPI"] and returns a detector returning true for "ScanAPI Monitor" and false for "Mozilla/5.0 Chrome/114.0". @testfalse when invoked with an empty string, undefined, or null instead of throwing. @test@generates
/**
* Builds a detector from a regex string or RegExp that is evaluated against user agent strings.
*
* @param {string|RegExp} patternSource
* @returns {(userAgent: string | null | undefined) => boolean}
*/
export function createBotDetector(patternSource);
/**
* Builds a detector from an array of pattern strings that are combined into a regex.
*
* @param {string[]} patterns
* @returns {(userAgent: string | null | undefined) => boolean}
*/
export function createDetectorFromList(patterns);Provides bot detection helpers for compiling custom bot matchers from regex inputs.