Socket
Socket
Sign inDemoInstall

uadetect

Package Overview
Dependencies
215
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 3.0.0

.github/CODE_OF_CONDUCT.md

5

.vs/VSWorkspaceState.json
{
"ExpandedNodes": [
"",
"\\src"
"\\src",
"\\tests"
],
"SelectedNode": "\\src\\ram.ts",
"SelectedNode": "\\src\\doNotTrack.ts",
"PreviewInSolutionExplorer": false
}

0

.vscode/launch.json

@@ -0,0 +0,0 @@ {

@@ -16,5 +16,8 @@ {

"tests",
"readme"
"readme",
"community"
"errors",
"docs"
],
"typescript.tsdk": "node_modules\\typescript\\lib"
}

@@ -25,3 +25,3 @@ let ua = navigator.userAgent;

else {
return 'unknown';
throw new Error("ERR: Browser can not be determined \(UAD_101\)");
}

@@ -28,0 +28,0 @@ };

let cookies = navigator.cookieEnabled;
const getCookies = (cookies) => {
if (cookies == true) {
if (cookies === true) {
return "COOKIES_enabled";
}
;
if (cookies == false) {
if (cookies === false) {
return "COOKIES_notEnabled";
}
else {
return "ERROR";
throw new Error("ERR: Cookie status can not be determined \(UAD_201\)");
}

@@ -13,0 +13,0 @@ };

@@ -0,0 +0,0 @@ //DEVICE TYPE

@@ -17,3 +17,3 @@ let browserDoNotTrack = navigator.doNotTrack;

else {
return "ERROR";
throw new Error("Unknown doNotTrack value\(UAD_801\)");
}

@@ -20,0 +20,0 @@ };

@@ -25,4 +25,3 @@ // Finite Device Type

else {
console.log("ERR: Unknown Device");
return "unknown";
throw new Error("Unknown device type\(UAD_601\)");
}

@@ -29,0 +28,0 @@ }

@@ -0,0 +0,0 @@ let getCurrentUA = () => {

@@ -1,1 +0,53 @@

declare module 'uadetect';
/*
Copyright © 2022, PorkyProductions, and it's contributors.
Licensed under the Apache-2.0 License.
*/
// The Declaration of the Library Itsself
declare module 'uadetect';
// ORIENTATION
declare const ORIENTATION_isLandscape: boolean;
// DEVICE TYPES
declare const DEVICE_type: string;
declare const DEVICE_finiteType: string;
// COOKIES
declare const cookieStatus: boolean;
// Do Not Track
declare const doNotTrackStatus: boolean;
// Browser
declare const browser: string;
// Browser Ram
declare const browserRam: number;
// Build Number
declare const buildNumber: number;
// Processor Cores
declare const processorCores: number;
// Max Touch Points
declare const maxTouchPoints: number;
// Online Status
declare const browserOnlineStatus: boolean;
// PDF Support
declare const PDFviewerStatus: boolean;
// Robot Status
declare const robotStatus: boolean;
// OS
declare const OS: string;

@@ -9,2 +9,6 @@ /*

import { browser, getBrowser } from "./browser";
// Build Number
import { buildNumber, browserSpecificSupportBuildID } from "./buildNumber";
// Code Name
import { codeName } from "./appCodeName";
// Cookies

@@ -18,2 +22,4 @@ import { getCookies, cookieStatus } from "./cookies";

import { DEVICE_finiteType, finiteMobileDeviceType, } from "./finiteMobileDeviceType";
// Geolocation
import { geo } from "./geolocation";
// Logical Processors

@@ -23,2 +29,4 @@ import { browserSpecificSupportCores, processorCores, } from "./logicalProcessors";

import { maxTouchPoints, getMaxTouchPoints } from "./maxTouchPoints";
// Navigator Object
import { navigatorObject } from './navigator';
// Online Status

@@ -34,4 +42,8 @@ import { browserOnlineStatus } from "./online";

import { PDFviewerStatus } from "./pdf";
// Product
import { engine } from './product';
// RAM
import { getRam, browserSpecificSupportRAM, browserRam } from "./ram";
// Version
import { version } from './appVersion';
// Webdriver

@@ -41,4 +53,4 @@ import { robotStatus } from "./webdriver";

// Make the functions accessible
export { DetectScreenOrientation, DetectDeviceType, finiteMobileDeviceType, getCurrentUA, getCookies, getDoNotTrack, getBrowser, getRam, browserSpecificSupportRAM, browserSpecificSupportCores, getMaxTouchPoints, getOS };
export { DetectScreenOrientation, DetectDeviceType, finiteMobileDeviceType, getCurrentUA, getCookies, getDoNotTrack, getBrowser, getRam, browserSpecificSupportRAM, browserSpecificSupportCores, getMaxTouchPoints, getOS, browserSpecificSupportBuildID };
// As well as the returns on those functions
export { ORIENTATION_isLandscape, DEVICE_type, DEVICE_finiteType, currentUA, cookieStatus, doNotTrackStatus, browser, browserRam, processorCores, maxTouchPoints, browserOnlineStatus, PDFviewerStatus, robotStatus, OS };
export { ORIENTATION_isLandscape, DEVICE_type, DEVICE_finiteType, currentUA, cookieStatus, doNotTrackStatus, browser, browserRam, buildNumber, processorCores, maxTouchPoints, navigatorObject, browserOnlineStatus, PDFviewerStatus, robotStatus, OS, geo, codeName, engine, version };

@@ -17,3 +17,3 @@ import { browser } from "./browser";

if (browser === "IE") {
return "Not Supported";
throw new Error("Not supported on this browser\(UAD_1301\)");
}

@@ -27,3 +27,3 @@ if (browser === "Opera") {

else {
return "Not Supported";
throw new Error("Not supported on this browser\(UAD_1301\)");
}

@@ -30,0 +30,0 @@ };

@@ -0,0 +0,0 @@ const getMaxTouchPoints = () => {

@@ -0,0 +0,0 @@ let browserIsOnline = navigator.onLine;

@@ -24,3 +24,3 @@ const getOS = ({ ua }) => {

else {
return 'unknown';
throw new Error("Unknown Operating System\(UAD_1101\)");
}

@@ -27,0 +27,0 @@ };

@@ -9,9 +9,2 @@ /*

let ORIENTATION_isLandscape = true;
$(document).ready(() => {
DetectScreenOrientation();
});
$(window).on("orientationchange", (_event) => {
//When screen orientation changes
DetectScreenOrientation();
});
const DetectScreenOrientation = () => {

@@ -22,3 +15,4 @@ //detects orientation of device

};
window.addEventListener("resize", DetectScreenOrientation);
// Exports
export { DetectScreenOrientation, ORIENTATION_isLandscape };

@@ -0,0 +0,0 @@ let pdf = navigator.pdfViewerEnabled;

@@ -11,9 +11,9 @@ import { browser } from "./browser";

if (browser == "Firefox") {
return "RAM API not availible in Firefox";
throw new Error("RAM API not supported on Firefox\(UAD_301\)");
}
if (browser == "Safari") {
return "RAM API not availible in Safari";
throw new Error("RAM API not supported on Safari\(UAD_302\)");
}
if (browser == "IE") {
return "RAM API not availible in IE";
throw new Error("RAM API not supported on IE\(UAD_303\)");
}

@@ -20,0 +20,0 @@ if (browser == "Opera") {

@@ -0,0 +0,0 @@ let webdriverControlled = navigator.webdriver;

@@ -0,0 +0,0 @@ # UADetect `browser` Componet

@@ -0,0 +0,0 @@ # UADetect `browserOnlineStatus` Componet

@@ -14,5 +14,5 @@ # UADetect Componets

- [`codeName`](codeName.md)
- [`browser`](browser.md)
- [`browserOnlineStatus`](browserOnlineStatus.md)
- [`browserRam`](browserRam.md)
- [`cookieStatus`](cookieStatus.md)

@@ -23,2 +23,3 @@ - [`currentUA`](currentUA.md)

- [`doNotTrackStatus`](doNotTrackStatus.md)
- [`engine`](engine.md)
- [`maxTouchPoints`](maxTouchPoints.md)

@@ -30,4 +31,5 @@ - [`ORIENTATION_isLandscape`](orientation.md)

- [`robotStatus`](robotStatus.md)
- [`version`](version.md)
### NOTE:
Click any of them to go to their individual documentation.

@@ -0,0 +0,0 @@ # UADetect `cookieStatus` Componet

@@ -0,0 +0,0 @@ # UADetect `currentUA` Componet

@@ -0,0 +0,0 @@ # UADetect `DEVICE_finiteType` Componet

@@ -0,0 +0,0 @@ # UADetect `DEVICE_type` Componet

@@ -0,0 +0,0 @@ # UADetect `doNotTrackStatus` Componet

@@ -10,2 +10,3 @@ # UADetect Documentation

- [LET's GO!](#lets-go)
- [OR Skip to Error Codes](#or-skip-to-error-codes)

@@ -41,1 +42,5 @@ ## WELCOME!

<button>[GO!](setup.md)</button>
### OR Skip to Error Codes
[ERROR CODES](error-codes.md)

@@ -0,0 +0,0 @@ # UADetect `maxTouchPoints` Componet

@@ -0,0 +0,0 @@ # UADetect `ORIENTATION_isLandscape` Componet

@@ -0,0 +0,0 @@ # UADetect `OS` Componet

@@ -0,0 +0,0 @@ # UADetect `PDFviewerStatus` Componet

@@ -0,0 +0,0 @@ # UADetect `processorCores` Componet

@@ -0,0 +0,0 @@ # UADetect `robotStatus` Componet

@@ -0,0 +0,0 @@ # SETUP

{
"files": [
"./index.js"
"./dist/**/*.js",
]
}
{
"name": "uadetect",
"version": "2.0.2",
"version": "3.0.0",
"description": "The dead-simple way of interacting with the navigator API",
"main": "./dist/index.js",
"scripts": {
"test": "npx serve",
"test": "jest",
"build": "npx tsc -p tsconfig.json"

@@ -48,10 +48,13 @@ },

"dependencies": {
"jquery": "^3.6.0",
"jest-environment-jsdom": "^28.1.0",
"serve": "^13.0.2",
"typescript": "^4.6.3",
"uadetect": "^2.0.0"
"typescript": "^4.7.2"
},
"devDependencies": {
"@types/jquery": "^3.5.14"
"@types/jest": "^27.5.1",
"@types/jquery": "^3.5.14",
"@types/node": "^17.0.35",
"jquery": "^3.6.0",
"jest": "^28.1.0"
}
}

@@ -0,0 +0,0 @@ # UADetect

@@ -28,3 +28,3 @@ let ua = navigator.userAgent;

else {
return 'unknown';
throw new Error("ERR: Browser can not be determined \(UAD_101\)");
}

@@ -31,0 +31,0 @@ };

let cookies: boolean = navigator.cookieEnabled
const getCookies = (cookies: boolean): "COOKIES_enabled" | "COOKIES_notEnabled" | "ERROR" => {
if (cookies == true) {
if (cookies === true) {
return "COOKIES_enabled"
};
if (cookies == false) {
if (cookies === false) {
return "COOKIES_notEnabled"
}
else {
return "ERROR"
throw new Error("ERR: Cookie status can not be determined \(UAD_201\)");
}

@@ -13,0 +14,0 @@ }

@@ -0,0 +0,0 @@ //DEVICE TYPE

@@ -17,3 +17,4 @@ let browserDoNotTrack = navigator.doNotTrack

else {
return "ERROR"
throw new Error("Unknown doNotTrack value\(UAD_801\)");
}

@@ -20,0 +21,0 @@ }

// Finite Device Type
export default function finiteMobileDeviceType(): "iOS" | "Android" | "BlackBerry" | "Windows Phone" | "webOS" | "unknown" {
export default function finiteMobileDeviceType(): "iOS" | "Android" | "BlackBerry" | "Windows Phone" | "webOS" | Error {
const ua = navigator.userAgent;

@@ -25,4 +25,3 @@ if (/(iPhone|iPod|iPad)/i.test(ua)) {

else {
console.log("ERR: Unknown Device");
return "unknown";
throw new Error("Unknown device type\(UAD_601\)");
}

@@ -29,0 +28,0 @@ }

@@ -0,0 +0,0 @@ let getCurrentUA = (): string => {

@@ -12,2 +12,6 @@ /*

// Code Name
import { codeName } from "./appCodeName";
// Cookies

@@ -32,2 +36,8 @@

// Geolocation
import {
geo
} from "./geolocation";
// Logical Processors

@@ -44,2 +54,6 @@

// Navigator Object
import { navigatorObject } from './navigator';
// Online Status

@@ -66,8 +80,12 @@

import { PDFviewerStatus } from "./pdf";
import { PDFviewerStatus } from "./pdf";
// RAM
// Product
import { getRam, browserSpecificSupportRAM, browserRam } from "./ram";
import {engine} from './product';
// Version
import {version} from './appVersion'
// Webdriver

@@ -89,7 +107,5 @@

getBrowser,
getRam,
browserSpecificSupportRAM,
browserSpecificSupportCores,
getMaxTouchPoints,
getOS
getOS,
};

@@ -107,9 +123,13 @@

browser,
browserRam,
processorCores,
maxTouchPoints,
navigatorObject,
browserOnlineStatus,
PDFviewerStatus,
robotStatus,
OS
OS,
geo,
codeName,
engine,
version
};

@@ -18,3 +18,3 @@ import { browser } from "./browser";

if (browser === "IE") {
return "Not Supported";
throw new Error("Not supported on this browser\(UAD_1301\)");
}

@@ -28,3 +28,4 @@ if (browser === "Opera") {

else {
return "Not Supported";
throw new Error("Not supported on this browser\(UAD_1301\)");
}

@@ -31,0 +32,0 @@

@@ -0,0 +0,0 @@ const getMaxTouchPoints = () => {

@@ -0,0 +0,0 @@ let browserIsOnline: boolean = navigator.onLine;

@@ -24,3 +24,4 @@ const getOS = ({ ua }: { ua; }): "Windows" | "Mac" | "Linux" | "Android" | "iOS" | "unknown" => {

else {
return 'unknown';
throw new Error("Unknown Operating System\(UAD_1101\)");
}

@@ -27,0 +28,0 @@ }

@@ -10,10 +10,4 @@ /*

let ORIENTATION_isLandscape: boolean = true;
$(document).ready((): void => {
DetectScreenOrientation();
});
$(window).on("orientationchange", (_event): void => {
//When screen orientation changes
DetectScreenOrientation();
});
const DetectScreenOrientation = () => {
const DetectScreenOrientation = (): boolean => {
//detects orientation of device

@@ -24,4 +18,7 @@ ORIENTATION_isLandscape = window.innerHeight <= window.innerWidth;

window.addEventListener("resize", DetectScreenOrientation);
// Exports
export { DetectScreenOrientation, ORIENTATION_isLandscape };

@@ -0,0 +0,0 @@ let pdf: boolean = navigator.pdfViewerEnabled;

@@ -14,2 +14,2 @@ let webdriverControlled: boolean = navigator.webdriver

export { robotStatus };
export { robotStatus, webdriverControlled };

@@ -1,1 +0,3 @@

console.log("NO test specified");
test("Make sure all imports are called", () => {
expect(true).toBe(true);
});
{
"compilerOptions": {
"target": "es2019",
"outDir": "./dist/"
"outDir": "./dist/",
"moduleResolution": "node",
"pretty": true,
},

@@ -6,0 +9,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc