mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-12-31 11:29:07 +03:00
Add new helper method: isFromEU() to detect whether user comes from an EU country
This commit is contained in:
2
src/helpers/ua-parser-helpers.d.ts
vendored
2
src/helpers/ua-parser-helpers.d.ts
vendored
@@ -7,6 +7,7 @@ import { IResult } from "../main/ua-parser";
|
||||
declare function getDeviceVendor(model: string): string | undefined;
|
||||
declare function isAppleSilicon(res: IResult): boolean;
|
||||
declare function isChromeFamily(res: IResult): boolean;
|
||||
declare function isFromEU(): boolean;
|
||||
declare function isFrozenUA(ua: string): boolean;
|
||||
declare function isStandalonePWA(): boolean;
|
||||
|
||||
@@ -14,6 +15,7 @@ export {
|
||||
getDeviceVendor,
|
||||
isAppleSilicon,
|
||||
isChromeFamily,
|
||||
isFromEU,
|
||||
isFrozenUA,
|
||||
isStandalonePWA
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
const { CPU, OS, Engine } = require('../enums/ua-parser-enums');
|
||||
const { UAParser } = require('../main/ua-parser');
|
||||
const { isFromEU } = require('detect-europe-js');
|
||||
|
||||
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
|
||||
|
||||
@@ -50,6 +51,7 @@ module.exports = {
|
||||
getDeviceVendor,
|
||||
isAppleSilicon,
|
||||
isChromeFamily,
|
||||
isFromEU,
|
||||
isFrozenUA,
|
||||
isStandalonePWA
|
||||
}
|
||||
Reference in New Issue
Block a user