New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipinfo

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipinfo - npm Package Compare versions

Comparing version

to
1.3.4

20

lib/index.js

@@ -1,3 +0,5 @@

const request = require("jsonrequest");
'use strict';
var request = require("jsonrequest");
/**

@@ -17,4 +19,4 @@ * ipInfo

*/
const ipInfo = module.exports = function (type, token, callback) {
let url = null;
var ipInfo = module.exports = function (type, token, callback) {
var url = null;

@@ -31,9 +33,9 @@ if (typeof token === "function") {

if(typeof token === "string") {
if (typeof token === "string") {
if (!type) {
url = ipInfo.HOSTNAME_SSL + "/json" + ipInfo.TOKEN_PREFIX + token;
url = ipInfo.HOSTNAME_SSL + "/json" + ipInfo.TOKEN_PREFIX + token;
} else if (ipInfo.IP_REGEX.test(type)) {
url = ipInfo.HOSTNAME_SSL + type + "/json" + ipInfo.TOKEN_PREFIX + token;
url = ipInfo.HOSTNAME_SSL + type + "/json" + ipInfo.TOKEN_PREFIX + token;
} else {
url = ipInfo.HOSTNAME_SSL + type + ipInfo.TOKEN_PREFIX + token;
url = ipInfo.HOSTNAME_SSL + type + ipInfo.TOKEN_PREFIX + token;
}

@@ -50,3 +52,3 @@ } else {

request(url, (err, body) => {
request(url, function (err, body) {
if (err && err.message && err.message.startsWith("Unexpected token")) {

@@ -65,2 +67,2 @@ err = null;

ipInfo.TOKEN_PREFIX = "?token=";
ipInfo.IP_REGEX = /^\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b$/;
ipInfo.IP_REGEX = /^\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b$/;
{
"name": "ipinfo",
"version": "1.3.3",
"version": "1.3.4",
"description": "An http://ipinfo.io NodeJS wrapper.",
"main": "lib/index.js",
"engines": {
"node": ">=4"
},
"scripts": {
"test": "node test"
"test": "nyc ava"
},

@@ -30,3 +33,7 @@ "repository": {

},
"devDependencies": {},
"devDependencies": {
"ava": "^0.17.0",
"nyc": "^10.0.0",
"pify": "^2.3.0"
},
"files": [

@@ -45,2 +52,2 @@ "bin/",

]
}
}
# ipinfo
[![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![AMA](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/ipinfo.svg)](https://www.npmjs.com/package/ipinfo) [![Downloads](https://img.shields.io/npm/dt/ipinfo.svg)](https://www.npmjs.com/package/ipinfo) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
[![Patreon](https://img.shields.io/badge/Support%20me%20on-Patreon-%23e6461a.svg)][patreon] [![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![AMA](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/ipinfo.svg)](https://www.npmjs.com/package/ipinfo) [![Downloads](https://img.shields.io/npm/dt/ipinfo.svg)](https://www.npmjs.com/package/ipinfo) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)

@@ -73,2 +73,12 @@ > An http://ipinfo.io NodeJS wrapper.

## :moneybag: Donations
Another way to support the development of my open-source modules is
to [set up a recurring donation, via Patreon][patreon]. :rocket:
[PayPal donations][paypal-donations] are appreciated too! Each dollar helps.
Thanks! :heart:
## :dizzy: Where is this library used?

@@ -79,2 +89,3 @@ If you are using this library in one of your projects, add it in this list. :sparkles:

- [`cli-sunset`](https://github.com/IonicaBizau/cli-sunset)—A fancy command line tool for knowing the sunset time.
- [`hapi-geo-locate`](https://github.com/fs-opensource/hapi-geo-locate#readme) (by Future Studio)—Provide IP geo location for incoming requests in hapi
- [`ipinfo-cli`](https://github.com/beatfreaker/ipinfo-cli) (by Chintan Radia)—Get current ip information

@@ -88,2 +99,3 @@ - [`sphere-ipinfo-mashup`](https://github.com/mmoelli/sphere-ipinfo-mashup) (by Martin Möllmann)—Create carts in SPHERE.IO with information based on your IP address.

[patreon]: https://www.patreon.com/ionicabizau
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW

@@ -90,0 +102,0 @@ [donate-now]: http://i.imgur.com/6cMbHOC.png

Sorry, the diff of this file is not supported yet