🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@libj/ip-filter

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libj/ip-filter - npm Package Compare versions

Comparing version

to
0.0.48

6

dist/common/isType/isType.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEnumVal = exports.isFn = exports.isObj = exports.isArr = exports.isNull = exports.isBool = exports.isNum = exports.isStr = void 0;
exports.isStr = function (val) { return typeof val === 'string'; }, exports.isNum = function (val) { return typeof val === 'number'; }, exports.isBool = function (val) { return typeof val === 'boolean'; }, exports.isNull = function (val) { return val === null; }, exports.isArr = function (val) { return Array.isArray(val); }, exports.isObj = function (val) { return typeof val === 'object' && !exports.isArr(val) && !exports.isNull(val); }, exports.isFn = function (val) { return typeof val === 'function'; };
exports.isEnumVal = function (Enum, val) { return (Object.values(Enum).indexOf(val) > -1); };
var isStr = function (val) { return typeof val === 'string'; }, isNum = function (val) { return typeof val === 'number'; }, isBool = function (val) { return typeof val === 'boolean'; }, isNull = function (val) { return val === null; }, isArr = function (val) { return Array.isArray(val); }, isObj = function (val) { return typeof val === 'object' && !(0, exports.isArr)(val) && !(0, exports.isNull)(val); }, isFn = function (val) { return typeof val === 'function'; };
exports.isStr = isStr, exports.isNum = isNum, exports.isBool = isBool, exports.isNull = isNull, exports.isArr = isArr, exports.isObj = isObj, exports.isFn = isFn;
var isEnumVal = function (Enum, val) { return (Object.values(Enum).indexOf(val) > -1); };
exports.isEnumVal = isEnumVal;
//# sourceMappingURL=isType.js.map

@@ -7,2 +7,2 @@ export interface LooseObject {

}
export declare type ValueOf<T> = T[keyof T];
export type ValueOf<T> = T[keyof T];

@@ -5,3 +5,4 @@ "use strict";

var ipRangeCheck = require("ip-range-check");
exports.isIpInRange = function (addr, range) { return ipRangeCheck(addr, range); };
var isIpInRange = function (addr, range) { return ipRangeCheck(addr, range); };
exports.isIpInRange = isIpInRange;
//# sourceMappingURL=isIpInRange.js.map

@@ -15,3 +15,3 @@ import { Request } from 'express';

}
export declare const makeIpFilterMiddleware: (config: Config) => (req: any, res: any, next: any) => any;
export declare const makeIpFilterMiddleware: (config: Config) => (req: Request, res: Response, next: NextFunction) => any;
export {};

@@ -7,3 +7,3 @@ "use strict";

var constants_1 = require("./constants");
exports.makeIpFilterMiddleware = function (config) { return function (req, res, next) {
var makeIpFilterMiddleware = function (config) { return function (req, res, next) {
var response = validateConfig(config).response, ip = defineIp(req, config);

@@ -26,2 +26,3 @@ if (ip) {

}; };
exports.makeIpFilterMiddleware = makeIpFilterMiddleware;
/*** Lib ***/

@@ -38,5 +39,5 @@ function defineIp(req, config) {

if (whitelist) {
return whitelist.indexOf(constants_1.WILDCARD_IP) > -1 ? true : isIpInRange_1.isIpInRange(ip, whitelist);
return whitelist.indexOf(constants_1.WILDCARD_IP) > -1 ? true : (0, isIpInRange_1.isIpInRange)(ip, whitelist);
}
return !isIpInRange_1.isIpInRange(ip, blacklist);
return !(0, isIpInRange_1.isIpInRange)(ip, blacklist);
}

@@ -59,3 +60,3 @@ function validateConfig(config) {

errorArgs = [
"Access denied to IP address '%s' according to " + listLabel + " '%j'",
"Access denied to IP address '%s' according to ".concat(listLabel, " '%j'"),
ip,

@@ -62,0 +63,0 @@ listValue,

{
"dependencies": {
"@libj/http-meta": "0.4.5",
"@libj/logger": "0.4.16",
"@libj/logger": "0.4.17",
"ip-range-check": "^0.2.0"
},
"name": "@libj/ip-filter",
"version": "0.0.47",
"version": "0.0.48",
"description": "Ip filter utils (function, middleware)",

@@ -38,3 +38,3 @@ "author": "Sergey Poskachey <seregynp@gmail.com>",

},
"gitHead": "4cdbad06d65596a3c43629e7615baae34ab987c1"
"gitHead": "ca66416e4e73150c002dca490ddcd5c023acfbbd"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet