Skip to content

Commit

Permalink
Merge pull request #66 from pbojinov/fix-build
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
pbojinov committed Jul 7, 2022
2 parents d121903 + 71870fa commit 3feaa13
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 6 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

## [Unreleased](https://github.com/pbojinov/request-ip/tree/HEAD)

[Full Changelog](https://github.com/pbojinov/request-ip/compare/3.0.2...HEAD)
[Full Changelog](https://github.com/pbojinov/request-ip/compare/3.1.0...HEAD)

**Closed issues:**

- Incompatible with Next.js middleware/Vercel edge functions [\#63](https://github.com/pbojinov/request-ip/issues/63)

## [3.1.0](https://github.com/pbojinov/request-ip/tree/3.1.0) (2022-07-06)

[Full Changelog](https://github.com/pbojinov/request-ip/compare/v4.0.0...3.1.0)

## [v4.0.0](https://github.com/pbojinov/request-ip/tree/v4.0.0) (2022-07-06)

[Full Changelog](https://github.com/pbojinov/request-ip/compare/3.0.2...v4.0.0)

**Merged pull requests:**

Expand Down
3 changes: 1 addition & 2 deletions dist/index.js → lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,4 @@ module.exports = {
getClientIpFromXForwardedFor: getClientIpFromXForwardedFor,
getClientIp: getClientIp,
mw: mw
};

};
42 changes: 42 additions & 0 deletions lib/is.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"use strict";

var regexes = {
ipv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,
ipv6: /^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i
};

function not(func) {
return function () {
return !func.apply(null, Array.prototype.slice.call(arguments));
};
}

function existy(value) {
return value != null;
}

function ip(value) {
return existy(value) && regexes.ipv4.test(value) || regexes.ipv6.test(value);
}

function object(value) {
return Object(value) === value;
}

function string(value) {
return Object.prototype.toString.call(value) === '[object String]';
}

var is = {
existy: existy,
ip: ip,
object: object,
string: string,
not: {
existy: not(existy),
ip: not(ip),
object: not(object),
string: not(string)
}
};
module.exports = is;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "request-ip",
"version": "3.1.0",
"version": "3.2.0",
"description": "A small Node.js module to retrieve the request's IP address",
"keywords": [
"request ip",
Expand Down Expand Up @@ -49,9 +49,9 @@
"files": [
"dist"
],
"main": "./dist/index.js",
"main": "./lib/index.js",
"scripts": {
"build": "babel ./src/index.js > ./dist/index.js",
"build": "babel src --out-dir lib",
"changelog": "github_changelog_generator -u pbojinov -p request-ip",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"test": "nyc --reporter=html --reporter=text --check-coverage --lines=100 --statements=100 tape ./test/*.js"
Expand Down

0 comments on commit 3feaa13

Please sign in to comment.