Skip to content

Commit

Permalink
fix most jshint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
awick committed Jan 15, 2019
1 parent bfda32f commit 69445f6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion wiseService/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"undef": true,
"strict": true,
"trailing": true,
"esversion": 6
"esversion": 6,
"validthis":true
}
3 changes: 2 additions & 1 deletion wiseService/source.elasticesearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ function ElasticsearchSource (api, section) {
}
});

if (!this.type)
if (!this.type) {
return;
}

this[this.api.funcName(this.type)] = this.sendResult;

Expand Down
7 changes: 4 additions & 3 deletions wiseService/source.opendns.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ OpenDNSSource.prototype.performQuery = function () {
console.log(this.section, "Error parsing for request:\n", postData, "\nresponse:\n", response);
results = {};
}

for (var result in results) {
var cbs = this.processing[result];
let cbs = this.processing[result];
if (!cbs) {
return;
}
delete this.processing[result];

var args = [this.statusField, this.statuses[results[result].status]];
let args = [this.statusField, this.statuses[results[result].status]];

if (results[result].security_categories) {
results[result].security_categories.forEach((value) => {
Expand All @@ -158,7 +159,7 @@ OpenDNSSource.prototype.performQuery = function () {

result = {num: args.length/2, buffer: wiseSource.encode.apply(null, args)};

var cb;
let cb;
while ((cb = cbs.shift())) {
cb(null, result);
}
Expand Down
6 changes: 3 additions & 3 deletions wiseService/source.reversedns.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
*/
'use strict';

var dns = require('dns')
var Dns = require('dns')
, iptrie = require('iptrie')
, wiseSource = require('./wiseSource.js')
, util = require('util')
;
var resolver = dns;
var resolver = Dns;
//////////////////////////////////////////////////////////////////////////////////
function removeArray(arr, value) {
var pos = 0;
Expand All @@ -38,7 +38,7 @@ function ReverseDNSSource (api, section) {
this.ips = api.getConfig("reversedns", "ips");
this.servers = api.getConfig("reversedns", "servers");
if (this.servers !== undefined) {
resolver = new Resolver();
resolver = new Dns();
resolver.setServers(this.servers.split(";"));
}
this.stripDomains = removeArray(api.getConfig("reversedns", "stripDomains", "").split(";").map(item => item.trim()), "");
Expand Down
14 changes: 7 additions & 7 deletions wiseService/sprintf.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exports.sprintf = function() {

// formatString()
var formatString = function (value, leftJustify, minWidth, precision, zeroPad, customPadChar) {
if (precision != null) {
if (precision !== null) {
value = value.slice(0, precision);
}
return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar);
Expand All @@ -76,7 +76,7 @@ exports.sprintf = function() {
var textTransform;
var value;

if (substring == '%%') {
if (substring === '%%') {
return '%';
}

Expand Down Expand Up @@ -114,9 +114,9 @@ exports.sprintf = function() {
// we want to ignore null, undefined and empty-string values
if (!minWidth) {
minWidth = 0;
} else if (minWidth == '*') {
} else if (minWidth === '*') {
minWidth = +a[i++];
} else if (minWidth.charAt(0) == '*') {
} else if (minWidth.charAt(0) === '*') {
minWidth = +a[minWidth.slice(1, -1)];
} else {
minWidth = +minWidth;
Expand All @@ -133,10 +133,10 @@ exports.sprintf = function() {
}

if (!precision) {
precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : undefined;
} else if (precision == '*') {
precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type === 'd') ? 0 : undefined;
} else if (precision === '*') {
precision = +a[i++];
} else if (precision.charAt(0) == '*') {
} else if (precision.charAt(0) === '*') {
precision = +a[precision.slice(1, -1)];
} else {
precision = +precision;
Expand Down
4 changes: 2 additions & 2 deletions wiseService/wiseCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

var LRU = require('lru-cache')
, redis = require('redis')
, bson = require('bson')
, BSON = new bson()
, Bson = require('bson')
, BSON = new Bson()
;


Expand Down
2 changes: 1 addition & 1 deletion wiseService/wiseService.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ function processQueryResponse0(req, res, queries, results) {
//////////////////////////////////////////////////////////////////////////////////
//
function processQueryResponse2(req, res, queries, results) {
var hashes = (req.query.hashes || "").split(",")
var hashes = (req.query.hashes || "").split(",");

const sendFields = !hashes.includes(internals.fieldsMd5);

Expand Down

0 comments on commit 69445f6

Please sign in to comment.