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.3

22

lib/index.js

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

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

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

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

@@ -33,9 +31,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;
}

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

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

@@ -67,2 +65,2 @@ }

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.2",
"version": "1.3.3",
"description": "An http://ipinfo.io NodeJS wrapper.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

# ipinfo
[![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)
[![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,12 +73,2 @@ > 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?

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

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

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