Comparing version 2.2.0 to 2.2.1
@@ -61,4 +61,4 @@ import LRU from 'lru-cache'; | ||
export default class IPData { | ||
apiKey?: string; | ||
cache?: LRU<string, LookupResponse>; | ||
apiKey: string; | ||
cache: LRU<string, LookupResponse>; | ||
constructor(apiKey: string, cacheConfig?: CacheConfig); | ||
@@ -65,0 +65,0 @@ lookup(ip?: string, selectField?: string, fields?: string[]): Promise<LookupResponse>; |
@@ -42,3 +42,3 @@ "use strict"; | ||
function isValidIP(ip) { | ||
return ip === DEFAULT_IP || is_ip_1.default(ip); | ||
return ip === DEFAULT_IP || (0, is_ip_1.default)(ip); | ||
} | ||
@@ -48,3 +48,3 @@ function isValidSelectField(field) { | ||
if (index === -1) { | ||
throw new Error(field + " is not a valid field."); | ||
throw new Error("".concat(field, " is not a valid field.")); | ||
} | ||
@@ -54,3 +54,3 @@ return true; | ||
function isValidFields(fields) { | ||
if (!isArray_1.default(fields)) { | ||
if (!(0, isArray_1.default)(fields)) { | ||
throw new Error('Fields should be an array.'); | ||
@@ -61,3 +61,3 @@ } | ||
if (index === -1) { | ||
throw new Error(field + " is not a valid field."); | ||
throw new Error("".concat(field, " is not a valid field.")); | ||
} | ||
@@ -69,3 +69,3 @@ }); | ||
function IPData(apiKey, cacheConfig) { | ||
if (!isString_1.default(apiKey)) { | ||
if (!(0, isString_1.default)(apiKey)) { | ||
throw new Error('An API key is required.'); | ||
@@ -84,5 +84,5 @@ } | ||
params = { 'api-key': this.apiKey }; | ||
url = ip ? url_join_1.default(BASE_URL, ip) : BASE_URL; | ||
url = ip ? (0, url_join_1.default)(BASE_URL, ip) : BASE_URL; | ||
if (ip && !isValidIP(ip)) { | ||
throw new Error(ip + " is an invalid IP address."); | ||
throw new Error("".concat(ip, " is an invalid IP address.")); | ||
} | ||
@@ -96,3 +96,3 @@ if (this.cache.has(ip || DEFAULT_IP)) { | ||
if (selectField && isValidSelectField(selectField)) { | ||
url = url_join_1.default(url, selectField); | ||
url = (0, url_join_1.default)(url, selectField); | ||
} | ||
@@ -141,3 +141,3 @@ if (fields && isValidFields(fields)) { | ||
if (!isValidIP(ip)) { | ||
throw new Error(ip + " is an invalid IP address."); | ||
throw new Error("".concat(ip, " is an invalid IP address.")); | ||
} | ||
@@ -158,3 +158,3 @@ if (_this.cache.has(ip)) { | ||
if (!(bulk.length > 0)) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, axios_1.default.post(url_join_1.default(BASE_URL, 'bulk'), bulk, { params: params })]; | ||
return [4 /*yield*/, axios_1.default.post((0, url_join_1.default)(BASE_URL, 'bulk'), bulk, { params: params })]; | ||
case 2: | ||
@@ -161,0 +161,0 @@ response_1 = _a.sent(); |
{ | ||
"name": "ipdata", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "JavaScript library to gather information for an ip using https://ipdata.co.", | ||
@@ -23,5 +23,5 @@ "main": "./lib/ipdata.js", | ||
"dependencies": { | ||
"axios": "^0.19.0", | ||
"axios": "^0.21.1", | ||
"is-ip": "^3.1.0", | ||
"lodash": "^4.17.15", | ||
"lodash": "^4.17.21", | ||
"lru-cache": "^5.1.1", | ||
@@ -46,2 +46,3 @@ "tslib": "^1.10.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-import-resolver-typescript": "^3.5.2", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
@@ -51,3 +52,3 @@ "jest": "^24.9.0", | ||
"ts-jest": "^24.1.0", | ||
"typescript": "^3.7.2" | ||
"typescript": "^4.6.3" | ||
}, | ||
@@ -54,0 +55,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19024
20
+ Addedaxios@0.21.4(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
- Removedaxios@0.19.2(transitive)
- Removedfollow-redirects@1.5.10(transitive)
Updatedaxios@^0.21.1
Updatedlodash@^4.17.21