mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-16 07:02:16 +03:00
Add new helper method isChromiumBased() to check whether the current browser is a Chromium-based browser
This commit is contained in:
6
src/helpers/ua-parser-helpers.d.ts
vendored
6
src/helpers/ua-parser-helpers.d.ts
vendored
@@ -4,8 +4,10 @@
|
||||
|
||||
import { IResult } from "../main/ua-parser";
|
||||
|
||||
declare function isAppleSilicon(res:IResult): boolean;
|
||||
declare function isAppleSilicon(res: IResult): boolean;
|
||||
declare function isChromiumBased(res: IResult): boolean;
|
||||
|
||||
export {
|
||||
isAppleSilicon
|
||||
isAppleSilicon,
|
||||
isChromiumBased
|
||||
}
|
||||
@@ -7,14 +7,15 @@
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
const { CPU, OS } = require('../enums/ua-parser-enums');
|
||||
const { CPU, OS, Engine } = require('../enums/ua-parser-enums');
|
||||
|
||||
const isAppleSilicon = function (res) {
|
||||
return res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM);
|
||||
}
|
||||
const isAppleSilicon = (res) => res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM);
|
||||
|
||||
const isChromiumBased = (res) => res.engine.is(Engine.BLINK);
|
||||
|
||||
module.exports = {
|
||||
isAppleSilicon
|
||||
isAppleSilicon,
|
||||
isChromiumBased
|
||||
}
|
||||
|
||||
// TODO: create test
|
||||
Reference in New Issue
Block a user