From adc9d6eae5c7f66c8e531bfbea12e774c15168db Mon Sep 17 00:00:00 2001 From: Elbert Alias Date: Tue, 27 Nov 2012 19:05:40 +1100 Subject: [PATCH] Replaced null with type checks --- drivers/bookmarklet/js/wappalyzer.js | 30 +++++++++++------------ drivers/chrome/js/wappalyzer.js | 30 +++++++++++------------ drivers/firefox-jetpack/lib/wappalyzer.js | 30 +++++++++++------------ drivers/firefox/content/js/driver.js | 2 +- drivers/firefox/content/js/wappalyzer.js | 30 +++++++++++------------ drivers/html/js/wappalyzer.js | 30 +++++++++++------------ drivers/php/js/wappalyzer.js | 30 +++++++++++------------ share/js/wappalyzer.js | 30 +++++++++++------------ 8 files changed, 106 insertions(+), 106 deletions(-) diff --git a/drivers/bookmarklet/js/wappalyzer.js b/drivers/bookmarklet/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/bookmarklet/js/wappalyzer.js +++ b/drivers/bookmarklet/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/drivers/chrome/js/wappalyzer.js b/drivers/chrome/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/chrome/js/wappalyzer.js +++ b/drivers/chrome/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/drivers/firefox-jetpack/lib/wappalyzer.js b/drivers/firefox-jetpack/lib/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/firefox-jetpack/lib/wappalyzer.js +++ b/drivers/firefox-jetpack/lib/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/drivers/firefox/content/js/driver.js b/drivers/firefox/content/js/driver.js index 9dafab763..c64fb155b 100644 --- a/drivers/firefox/content/js/driver.js +++ b/drivers/firefox/content/js/driver.js @@ -94,7 +94,7 @@ if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) { if ( request.nsIHttpChannel && request.contentType == 'text/html' ) { if ( progress.currentURI && request.name == progress.currentURI.spec ) { - var headers = new Object(); + var headers = {}; request.nsIHttpChannel.visitResponseHeaders(function(header, value) { headers[header] = value; diff --git a/drivers/firefox/content/js/wappalyzer.js b/drivers/firefox/content/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/firefox/content/js/wappalyzer.js +++ b/drivers/firefox/content/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/drivers/html/js/wappalyzer.js b/drivers/html/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/html/js/wappalyzer.js +++ b/drivers/html/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/drivers/php/js/wappalyzer.js b/drivers/php/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/drivers/php/js/wappalyzer.js +++ b/drivers/php/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null; diff --git a/share/js/wappalyzer.js b/share/js/wappalyzer.js index 8298ca544..351c923b8 100644 --- a/share/js/wappalyzer.js +++ b/share/js/wappalyzer.js @@ -51,7 +51,7 @@ var wappalyzer = (function() { */ log: function(message, type) { if ( w.config.environment === 'dev' ) { - if ( type == null ) { type = 'debug'; } + if ( typeof type === 'undefined' ) { type = 'debug'; } driver('log', { message: '[wappalyzer ' + type + '] ' + message, type: type }); } @@ -64,7 +64,7 @@ var wappalyzer = (function() { w.log('w.init'); // Checks - if ( w.driver == null ) { + if ( typeof w.driver === 'undefined' ) { w.log('no driver, exiting'); return; @@ -96,13 +96,13 @@ var wappalyzer = (function() { data.url = url; - if ( w.apps == null || w.categories == null ) { + if ( typeof w.apps === 'undefined' || typeof w.categories === 'undefined' ) { w.log('apps.json not loaded'); return; } - if ( w.detected[url] == null ) { + if ( typeof w.detected[url] === 'undefined' ) { w.detected[url] = []; } @@ -110,9 +110,9 @@ var wappalyzer = (function() { i, app, type, regex, regexMeta, regexScript, match, content, meta, header, profiler = { regexCount: 0, - startTime: ( new Date ).getTime() + startTime: new Date().getTime() }, - apps = [] + apps = [] ; appLoop: @@ -137,7 +137,7 @@ var wappalyzer = (function() { break; case 'html': - if ( data[type] == null ) { + if ( typeof data[type] !== 'string' || !data.html ) { break; } @@ -153,7 +153,7 @@ var wappalyzer = (function() { break; case 'script': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -174,7 +174,7 @@ var wappalyzer = (function() { break; case 'meta': - if ( data.html == null ) { + if ( typeof data.html !== 'string' || !data.html ) { break; } @@ -204,7 +204,7 @@ var wappalyzer = (function() { break; case 'headers': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -213,7 +213,7 @@ var wappalyzer = (function() { profiler.regexCount ++; - if ( data[type][header] != null && regex.test(data[type][header]) ) { + if ( typeof data[type][header] === 'string' && regex.test(data[type][header]) ) { apps.push(app); continue appLoop; @@ -222,7 +222,7 @@ var wappalyzer = (function() { break; case 'env': - if ( data[type] == null ) { + if ( typeof data[type] !== 'object' || !data[type] ) { break; } @@ -299,10 +299,10 @@ var wappalyzer = (function() { // Additional information if ( typeof w.ping.hostnames !== 'undefined' && typeof w.ping.hostnames[hostname] !== 'undefined' ) { - if ( data.html != null ) { + if ( typeof data.html === 'string' && data.html ) { match = data.html.match(/]*[: ]lang="([a-z]{2}((-|_)[A-Z]{2})?)"/i); - if ( match != null && match.length ) { + if ( match.length ) { w.ping.hostnames[hostname].meta['language'] = match[1]; } @@ -322,7 +322,7 @@ var wappalyzer = (function() { w.log(hostname + ': ' + JSON.stringify(w.ping.hostnames[hostname])); } - if ( w.ping.hostnames != null && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } + if ( typeof w.ping.hostnames === 'object' && Object.keys(w.ping.hostnames).length >= 50 ) { driver('ping'); } apps = null; data = null;