Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-device-detector

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-device-detector - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

parser/device/brand-short.js

6

index.js

@@ -148,2 +148,8 @@ module.exports = DeviceDetector;

//@todo add parser vendor fragment
if (this.deviceData.id === '' && ['ATV', 'IOS', 'MAC'].indexOf(osShortName) !== -1) {
this.deviceData.id = 'AP';
}
if (deviceType === '' && this.isAndroid() && CHROME_CLIENT_LIST.indexOf(clientName) !== -1) {

@@ -150,0 +156,0 @@ if (helper.matchUserAgent('Chrome/[\\.0-9]* Mobile', this.userAgent) !== null) {

2

package.json
{
"name": "node-device-detector",
"version": "1.1.1",
"version": "1.1.2",
"description": "Nodejs device detector (port Piwik)",

@@ -5,0 +5,0 @@ "main": "index.js",

const ParserAbstract = require('./abstract-parser');
const util = require('util');
const collectionBrand = Object.assign({},
...Object.entries(require('./device/brand-short')).map(([a, b]) => ({[b]: a})), {});
function DeviceParserAbstract() {

@@ -14,3 +17,3 @@ this.model = '';

DeviceParserAbstract.prototype.reset = function(){
DeviceParserAbstract.prototype.reset = function () {
this.model = '';

@@ -22,5 +25,5 @@ this.brand = '';

DeviceParserAbstract.prototype.getParseData = function(){
DeviceParserAbstract.prototype.getParseData = function () {
return {
id : this.id,
id: this.id,
type: this.type,

@@ -37,3 +40,3 @@ brand: this.brand,

*/
DeviceParserAbstract.prototype.parse = function(userAgent) {
DeviceParserAbstract.prototype.parse = function (userAgent) {
this.reset();

@@ -43,4 +46,4 @@

let deviceType = '';
let brandId = '';
let brandName = '';
for (let cursor in this.collection) {

@@ -51,3 +54,6 @@ let item = this.collection[cursor];

if (match) {
if(item['device']!== undefined){
brandName = String(cursor).trim();
if (item['device'] !== undefined) {
deviceType = item['device'];

@@ -66,4 +72,8 @@ }

}
if (data.brand !== undefined) {
brandName = data.brand;
}
break;
}
}

@@ -74,6 +84,8 @@ } else if (item['model'] !== undefined) {

this.brand = String(cursor).trim();
this.model = model!== null ? String(model).trim() : '';
let brandId = collectionBrand[brandName];
this.brand = brandName;
this.model = model !== null ? String(model).trim() : '';
this.type = deviceType;
this.id = brandId;
this.id = brandId !== undefined ? brandId : '';

@@ -87,3 +99,2 @@ return true;

module.exports = DeviceParserAbstract;

@@ -7,2 +7,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function Camera() {
Camera.super_.call(this);
this.fixtureFile = 'device/cameras.yml';

@@ -9,0 +10,0 @@ this.loadCollection();

@@ -7,2 +7,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function CarBrowser() {
CarBrowser.super_.call(this);
this.fixtureFile = 'device/car_browsers.yml';

@@ -9,0 +10,0 @@ this.loadCollection();

@@ -5,2 +5,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function Console() {
Console.super_.call(this);
this.fixtureFile = 'device/consoles.yml';

@@ -7,0 +8,0 @@ this.loadCollection();

@@ -7,2 +7,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function HbbTv() {
HbbTv.super_.call(this);
this.fixtureFile = 'device/televisions.yml';

@@ -9,0 +10,0 @@ this.loadCollection();

@@ -6,2 +6,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function Mobile() {
Mobile.super_.call(this);
this.fixtureFile = 'device/mobiles.yml';

@@ -8,0 +9,0 @@ this.loadCollection();

@@ -7,2 +7,3 @@ const DeviceAbstractParser = require('./../device-abstract-parser');

function PortableMediaPlayer() {
PortableMediaPlayer.super_.call(this);
this.fixtureFile = 'device/portable_media_player.yml';

@@ -9,0 +10,0 @@ this.loadCollection();

@@ -120,3 +120,5 @@ const detector = new (require('../index'));

}
if(isObjNotEmpty(fixture.device.brand)){
expect(String(fixture.device.brand), messageError).to.equal(result.device.id);
}
}

@@ -182,3 +184,3 @@

// describe('dev test one file', function () {
// let file = 'bots.yml';
// let file = 'camera.yml';
// let fixtureData = YML.load(fixtureFolder + file);

@@ -185,0 +187,0 @@ // let total = fixtureData.length;

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc