Skip to content

Commit

Permalink
Add new helper method: isFrozenUA() to match with frozen user-agent…
Browse files Browse the repository at this point in the history
… pattern
  • Loading branch information
faisalman committed Jan 25, 2024
1 parent 7c22bc5 commit b5b5475
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/helpers/ua-parser-helpers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { IResult } from "../main/ua-parser";

declare function isAppleSilicon(res: IResult): boolean;
declare function isChromiumBased(res: IResult): boolean;
declare function isFrozenUA(ua: string): boolean;

export {
isAppleSilicon,
isChromiumBased
isChromiumBased,
isFrozenUA
}
5 changes: 4 additions & 1 deletion src/helpers/ua-parser-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const isAppleSilicon = (res) => res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM);

const isChromiumBased = (res) => res.engine.is(Engine.BLINK);

const isFrozenUA = (ua) => /^Mozilla\/5\.0 \((Windows NT 10\.0; Win64; x64|Macintosh; Intel Mac OS X 10_15_7|X11; Linux x86_64|X11; CrOS x86_64 14541\.0\.0|Fuchsia|Linux; Android 10; K)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/\d+\.0\.0\.0 (Mobile )?Safari\/537\.36/.test(ua);

module.exports = {
isAppleSilicon,
isChromiumBased
isChromiumBased,
isFrozenUA
}

0 comments on commit b5b5475

Please sign in to comment.