docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that analyzes website visitor browser information and determines compatibility using flexible browser name matching.
Build a browser compatibility checking system that accepts user agent strings and checks them against a set of compatibility rules. The system should support both full browser names and common short aliases for convenience.
The system should provide a function that:
The checker must support both full browser names (e.g., "Google Chrome", "Mozilla Firefox") and common short aliases (e.g., "chrome", "firefox") interchangeably. When checking compatibility, the system should recognize that aliases refer to their full browser name equivalents.
/**
* Checks if a browser is compatible based on its user agent string.
*
* @param {string} userAgent - The user agent string to check
* @param {string[]} compatibleBrowsers - Array of compatible browser names or aliases
* @returns {boolean} True if the browser is in the compatibility list, false otherwise
*/
function checkCompatibility(userAgent, compatibleBrowsers) {
// IMPLEMENTATION HERE
}
module.exports = {
checkCompatibility,
};Provides browser detection and parsing capabilities from user agent strings.