UNPKG

@canmertinyo/rate-limiter-core

Version:

A simple rate-limiting middleware for Express.js with support for in-memory, Redis, and MongoDB storage

14 lines (13 loc) 458 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isFunction = exports.getTimestamp = exports.getIp = void 0; const getIp = (req) => { return req.ip || req.headers["x-forwarded-for"] || "unknown"; }; exports.getIp = getIp; const getTimestamp = () => { return new Date().getTime(); }; exports.getTimestamp = getTimestamp; const isFunction = (object) => typeof object === "function"; exports.isFunction = isFunction;