ipgeolocation
Advanced tools
Comparing version 1.1.6 to 2.0.0
49
index.js
@@ -6,15 +6,15 @@ exports.Ipgeo = function Ipgeo(apiKey){ | ||
this.ipgeoByFieldsAndIp = function(fields="" ,ip="") { | ||
request("ipgeo", this.apiKey, fields, ip); | ||
request("ipgeo", this.apiKey, fields, ip, ""); | ||
}; | ||
this.ipgeoByFields = function(fields="") { | ||
request("ipgeo", this.apiKey, fields, ""); | ||
request("ipgeo", this.apiKey, fields, "", ""); | ||
}; | ||
this.ipgeoByIp = function(ip="") { | ||
request("ipgeo", this.apiKey, "", ip); | ||
request("ipgeo", this.apiKey, "", ip, ""); | ||
}; | ||
this.ipgeoByApikey = function(){ | ||
request("ipgeo", this.apiKey,"","") | ||
request("ipgeo", this.apiKey, "", "", "") | ||
}; | ||
@@ -30,29 +30,36 @@ | ||
this.timezoneByIp = function(ip="") { | ||
request("timezone", this.apiKey,"",ip); | ||
request("timezone", this.apiKey, "", ip, ""); | ||
} | ||
this.timezoneByApikey = function() { | ||
request("timezone", this.apiKey,"",""); | ||
request("timezone", this.apiKey, "", "", ""); | ||
} | ||
this.timezoneByTz = function(tz="") { | ||
request("timezone", this.apiKey, "", "", tz); | ||
} | ||
} | ||
function request(subUrl=null, apiKey="",fields="",ip=""){ | ||
function request(subUrl=null, apiKey="", fields="", ip="", tz=""){ | ||
var URL = ""; | ||
if(apiKey){ | ||
URL = subUrl; | ||
URL = URL + ("?apiKey=" + apiKey); | ||
} | ||
if(fields){ | ||
URL = URL + "&fields="; | ||
URL = URL + fields; | ||
} | ||
if(ip){ | ||
URL = URL + "&ip="; | ||
URL = URL + ip; | ||
} | ||
URL = subUrl; | ||
URL = URL + ("?apiKey=" + apiKey); | ||
if(fields){ | ||
URL = URL + "&fields="; | ||
URL = URL + fields; | ||
} | ||
if(ip){ | ||
URL = URL + "&ip="; | ||
URL = URL + ip; | ||
} | ||
if(tz){ | ||
URL = URL + "&tz="; | ||
URL = URL + tz; | ||
} | ||
} | ||
var data = null; | ||
@@ -64,3 +71,5 @@ var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; | ||
if (this.readyState === 4) { | ||
console.log(this.responseText); | ||
var data = JSON.parse(this.responseText); | ||
console.log(data); | ||
return data; | ||
} | ||
@@ -67,0 +76,0 @@ }); |
{ | ||
"name": "ipgeolocation", | ||
"version": "1.1.6", | ||
"version": "2.0.0", | ||
"description": "new pkg", | ||
@@ -10,5 +10,5 @@ "main": "index.js", | ||
"keywords": [ | ||
"demo" | ||
"ipgeolocation" | ||
], | ||
"author": "NPM Demo <ahsan@jfreaks.com> (http://ipgeolocation.io)", | ||
"author": "NPM ipgeolocation <support@ipgeolocation.io> (http://ipgeolocation.io)", | ||
"license": "ISC", | ||
@@ -15,0 +15,0 @@ "dependencies": { |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
1922
59
1