mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Add new helper method isChromiumBased()
to check whether the current browser is a Chromium-based browser
This commit is contained in:
parent
7ad3e3b451
commit
7abc8b9ecc
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-alpha.3",
|
"version": "2.0.0-beta.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-alpha.3",
|
"version": "2.0.0-beta.1",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
|
4
src/helpers/ua-parser-helpers.d.ts
vendored
4
src/helpers/ua-parser-helpers.d.ts
vendored
@ -5,7 +5,9 @@
|
|||||||
import { IResult } from "../main/ua-parser";
|
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 {
|
export {
|
||||||
isAppleSilicon
|
isAppleSilicon,
|
||||||
|
isChromiumBased
|
||||||
}
|
}
|
@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
/*jshint esversion: 6 */
|
/*jshint esversion: 6 */
|
||||||
|
|
||||||
const { CPU, OS } = require('../enums/ua-parser-enums');
|
const { CPU, OS, Engine } = require('../enums/ua-parser-enums');
|
||||||
|
|
||||||
const isAppleSilicon = function (res) {
|
const isAppleSilicon = (res) => res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM);
|
||||||
return res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM);
|
|
||||||
}
|
const isChromiumBased = (res) => res.engine.is(Engine.BLINK);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
isAppleSilicon
|
isAppleSilicon,
|
||||||
|
isChromiumBased
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: create test
|
// TODO: create test
|
@ -1,4 +1,3 @@
|
|||||||
// @ts-check
|
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user