UNPKG

nest-ratelimiter

Version:

Distributed consistent flexible NestJS rate limiter based on Redis

13 lines 663 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultErrorBodyCreator = void 0; const defaultErrorBodyCreator = (limit) => { // When using custom errorBodyCreator don't have to install this module // When using this one, 'ms' will be cached after first call, so it's ok // eslint-disable-next-line @typescript-eslint/no-require-imports const ms = require('ms'); const delta = (limit.reset * 1000 - Date.now()) | 0; return 'Rate limit exceeded, retry in ' + ms(delta, { long: true }); }; exports.defaultErrorBodyCreator = defaultErrorBodyCreator; //# sourceMappingURL=default-error-body-creator.js.map