fetch-retry
Advanced tools
Comparing version 3.1.0 to 3.2.1
'use strict'; | ||
require('es6-promise').polyfill(); | ||
module.exports = function (fetch, defaults = {}) { | ||
module.exports = function (fetch, defaults) { | ||
defaults = defaults || {}; | ||
if (typeof fetch !== 'function') { | ||
@@ -25,3 +26,3 @@ throw new ArgumentError('fetch must be a function'); | ||
const baseDefaults = { | ||
var baseDefaults = { | ||
retries: 3, | ||
@@ -28,0 +29,0 @@ retryDelay: 1000, |
{ | ||
"name": "fetch-retry", | ||
"version": "3.1.0", | ||
"version": "3.2.1", | ||
"description": "Extend any fetch library with retry functionality", | ||
@@ -28,7 +28,7 @@ "repository": "https://github.com/jonbern/fetch-retry.git", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^6.2.2", | ||
"eslint": "^6.8.0", | ||
"expectations": "^0.7.1", | ||
"express": "^4.17.1", | ||
"isomorphic-fetch": "^2.2.1", | ||
"mocha": "^5.2.0", | ||
"mocha": "^8.0.1", | ||
"nyc": "^14.1.1", | ||
@@ -35,0 +35,0 @@ "sinon": "^6.3.5" |
@@ -9,3 +9,3 @@ 'use strict'; | ||
it('should accept fetch function as argument', function () { | ||
it('throws when fetch is not a function', function () { | ||
expect(function () { | ||
@@ -19,5 +19,5 @@ fetchBuilder(); | ||
it('should accept defaults object as argument', function () { | ||
it('throws when default is not an object', function () { | ||
expect(function () { | ||
fetchBuilder(function () { }, ""); | ||
fetchBuilder(function () { }, 'this is a string, not an object'); | ||
}).toThrow({ | ||
@@ -29,3 +29,3 @@ name: 'ArgumentError', | ||
it('should return fetchRetry function', function () { | ||
it('returns fetchRetry when provided valid constructor arguments', function () { | ||
expect(typeof fetchBuilder(function () { }, {retries: 1})).toBe('function'); | ||
@@ -390,3 +390,3 @@ }); | ||
}) | ||
describe('when #init.retries=1', function () { | ||
@@ -393,0 +393,0 @@ |
40205
1020