node-ipinfo
Advanced tools
Comparing version 3.5.3 to 3.5.5
@@ -111,3 +111,11 @@ "use strict"; | ||
res.on("close", function () { | ||
var ipinfo = JSON.parse(data); | ||
var ipinfo; | ||
try { | ||
ipinfo = JSON.parse(data); | ||
} | ||
catch (_a) { | ||
reject(new Error("error parsing JSON response")); | ||
return; | ||
} | ||
; | ||
if (ipinfo.country) { | ||
@@ -153,2 +161,5 @@ ipinfo.countryCode = ipinfo.country; | ||
}); | ||
req.on("timeout", function () { | ||
reject(new Error("timeout reached")); | ||
}); | ||
req.on("error", function (error) { | ||
@@ -200,3 +211,11 @@ reject(error); | ||
res.on("close", function () { | ||
var asnResp = JSON.parse(data); | ||
var asnResp; | ||
try { | ||
asnResp = JSON.parse(data); | ||
} | ||
catch (_a) { | ||
reject(new Error("error parsing JSON response")); | ||
return; | ||
} | ||
; | ||
if (asnResp.country) { | ||
@@ -225,2 +244,5 @@ asnResp.countryCode = asnResp.country; | ||
}); | ||
req.on("timeout", function () { | ||
reject(new Error("timeout reached")); | ||
}); | ||
req.on("error", function (error) { | ||
@@ -269,3 +291,12 @@ reject(error); | ||
res.on("close", function () { | ||
resolve(JSON.parse(data)); | ||
var response; | ||
try { | ||
response = JSON.parse(data); | ||
} | ||
catch (_a) { | ||
reject(new Error("error parsing JSON response")); | ||
return; | ||
} | ||
; | ||
resolve(response); | ||
}); | ||
@@ -287,2 +318,5 @@ res.on("error", function (error) { | ||
}); | ||
req.on("timeout", function () { | ||
reject(new Error("timeout reached")); | ||
}); | ||
req.on("error", function (error) { | ||
@@ -407,3 +441,10 @@ reject(error); | ||
values.forEach(function (el) { | ||
var batchResp = JSON.parse(el); | ||
var batchResp; | ||
try { | ||
batchResp = JSON.parse(el); | ||
} | ||
catch (_a) { | ||
batchResp = {}; | ||
} | ||
; | ||
for (var key in batchResp) { | ||
@@ -410,0 +451,0 @@ if (batchResp.hasOwnProperty(key)) { |
@@ -1,2 +0,2 @@ | ||
declare const VERSION = "3.5.3"; | ||
declare const VERSION = "3.5.5"; | ||
export default VERSION; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var VERSION = "3.5.3"; | ||
var VERSION = "3.5.5"; | ||
exports.default = VERSION; |
{ | ||
"name": "node-ipinfo", | ||
"version": "3.5.3", | ||
"version": "3.5.5", | ||
"description": "Official Node client library for IPinfo", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
158631
5088
1