You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

retry

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retry - npm Package Compare versions

Comparing version

to
0.4.0

2

example/dns.js

@@ -14,3 +14,3 @@ var dns = require('dns');

operation.try(function(currentAttempt) {
operation.attempt(function(currentAttempt) {
dns.resolve(address, function(err, addresses) {

@@ -17,0 +17,0 @@ if (operation.retry(err)) {

@@ -27,3 +27,3 @@ function RetryOperation(timeouts) {

RetryOperation.prototype.try = function(fn) {
RetryOperation.prototype.attempt = function(fn) {
this._fn = fn;

@@ -33,2 +33,12 @@ this._fn(this._attempts);

RetryOperation.prototype.try = function(fn) {
console.log('Using RetryOperation.try() is deprecated');
this.attempt(fn);
};
RetryOperation.prototype.start = function(fn) {
console.log('Using RetryOperation.start() is deprecated');
this.attempt(fn);
};
RetryOperation.prototype.start = RetryOperation.prototype.try;

@@ -35,0 +45,0 @@

@@ -5,3 +5,3 @@ {

"description": "Abstraction for exponential and custom retry strategies for failed operations.",
"version": "0.3.0",
"version": "0.4.0",
"homepage": "https://github.com/felixge/node-retry",

@@ -8,0 +8,0 @@ "repository": {

@@ -26,3 +26,3 @@ # retry

operation.try(function(currentAttempt) {
operation.attempt(function(currentAttempt) {
dns.resolve(address, function(err, addresses) {

@@ -113,3 +113,3 @@ if (operation.retry(err)) {

#### retryOperation.try(fn)
#### retryOperation.attempt(fn)

@@ -119,5 +119,9 @@ Defines the function `fn` that is to be retried and executes it for the first

#### retryOperation.try(fn)
This is an alias for `retryOperation.attempt(fn)`. This is deprecated.
#### retryOperation.start(fn)
This is an alias for `retryOperation.try(fn)`.
This is an alias for `retryOperation.attempt(fn)`. This is deprecated.

@@ -139,1 +143,10 @@ #### retryOperation.retry(error)

retry is licensed under the MIT license.
#Changelog
0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.
0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().
0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().

@@ -43,3 +43,3 @@ var common = require('../common');

var fn = new Function();
operation.try(fn);
operation.attempt(fn);
assert.strictEqual(fn, operation._fn);

@@ -58,3 +58,3 @@ })();

var fn = function() {
operation.try(function(currentAttempt) {
operation.attempt(function(currentAttempt) {
attempts++;

@@ -61,0 +61,0 @@ assert.equal(currentAttempt, attempts);