UNPKG

retryable-document-client

Version:
16 lines (15 loc) 662 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var base_1 = require("./base"); var defaults_1 = require("./defaults"); ; var strategy = function (options) { var exponentBase = (options && options.exponentBase) || defaults_1.default.exponentBase; var multiplier = (options && options.multiplier) || defaults_1.default.multiplier; var constant = (options && options.constant) || defaults_1.default.constant; var calculateTimeout = function (attempt) { return (Math.pow(exponentBase, attempt) * multiplier) + constant; }; return base_1.default(calculateTimeout, options); }; exports.default = strategy;