1
0
mirror of https://github.com/lancedikson/bowser synced 2025-12-05 06:02:14 +00:00
This commit is contained in:
Copilot 2025-11-29 02:01:34 +02:00 committed by GitHub
commit d83992aafd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

66
index.d.ts vendored
View File

@ -2,42 +2,16 @@
// Project: https://github.com/lancedikson/bowser
// Definitions by: Alexander P. Cerutti <https://github.com/alexandercerutti>,
export = Bowser;
export as namespace Bowser;
export function getParser(UA: string, skipParsing?: boolean): Bowser.Parser.Parser;
export function parse(UA: string): Bowser.Parser.ParsedResult;
export function getParser(UA: string, skipParsing?: boolean): Parser.Parser;
export function parse(UA: string): Parser.ParsedResult;
export const BROWSER_MAP: Record<string, string>;
export const ENGINE_MAP: Record<string, string>;
export const OS_MAP: Record<string, string>;
export const PLATFORMS_MAP: Record<string, string>;
declare namespace Bowser {
/**
* Creates a Parser instance
* @param {string} UA - User agent string
* @param {boolean} skipParsing
*/
function getParser(UA: string, skipParsing?: boolean): Parser.Parser;
/**
* Creates a Parser instance and runs Parser.getResult immediately
* @param UA - User agent string
* @returns {Parser.ParsedResult}
*/
function parse(UA: string): Parser.ParsedResult;
/**
* Constants exposed via bowser getters
*/
const BROWSER_MAP: Record<string, string>;
const ENGINE_MAP: Record<string, string>;
const OS_MAP: Record<string, string>;
const PLATFORMS_MAP: Record<string, string>;
namespace Parser {
export namespace Parser {
interface Parser {
constructor(UA: string, skipParsing?: boolean): Parser.Parser;
@ -240,39 +214,6 @@ declare namespace Bowser {
satisfies(checkTree: checkTree): boolean | undefined;
/**
* Check if the browser name equals the passed string
* @param {string} browserName The string to compare with the browser name
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
* @returns {boolean}
*/
isBrowser(browserName: string, includingAlias?: boolean): boolean;
/**
* Check if the engine name equals the passed string
* @param {string} engineName The string to compare with the engine name
* @returns {boolean}
*/
isEngine(engineName: string): boolean;
/**
* Check if the platform type equals the passed string
* @param {string} platformType The string to compare with the platform type
* @returns {boolean}
*/
isPlatform(platformType: string): boolean;
/**
* Check if the OS name equals the passed string
* @param {string} osName The string to compare with the OS name
* @returns {boolean}
*/
isOS(osName: string): boolean;
/**
* Check if any of the given values satisfies `.is(anything)`
* @param {string[]} anythings
@ -318,5 +259,4 @@ declare namespace Bowser {
interface checkTree {
[key: string]: any;
}
}
}