🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

polly-js

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polly-js - npm Package Compare versions

Comparing version

to
1.2.0

tests/hello.txt

2

package.json
{
"name": "polly-js",
"version": "1.1.1",
"version": "1.2.0",
"description": "Transient exception handling",

@@ -5,0 +5,0 @@ "main": "src/polly.js",

# polly-js
Transient exception handling for JavaScript
Transient exception handling for JavaScript made easy.
[![npm version](https://img.shields.io/npm/v/polly-js.svg?style=flat-square)](https://www.npmjs.org/package/polly-js)
[![npm downloads](https://img.shields.io/npm/dm/polly-jst.svg?style=flat-square)](http://npm-stat.com/charts.html?package=polly-js&from=2015-09-01)
[![npm downloads](https://img.shields.io/npm/dm/polly-js.svg?style=flat-square)](http://npm-stat.com/charts.html?package=polly-js&from=2015-09-01)
[![Dependency Status](https://david-dm.org/mauricedb/polly-js.svg)](https://david-dm.org/mauricedb/polly-js)

@@ -17,3 +17,3 @@ [![Build Status](https://travis-ci.org/mauricedb/polly-js.svg?branch=master)](https://travis-ci.org/mauricedb/polly-js)

Try to load the Google home page and rety twice if it fails
Try to load the Google home page and retry twice if it fails

@@ -33,2 +33,15 @@ ```JavaScript

```JavaScript
polly
.retry(2)
.executeForNode(function (cb) {
fs.readFile(path.join(__dirname, './hello.txt'), cb);
}, function (err, data) {
if (err) {
console.error('Failed trying three times', err)
} else {
console.log(data)
}
});
```

@@ -35,0 +48,0 @@ ## Acknowledgements

@@ -61,2 +61,18 @@ /**

function executeForNode(config, fn, callback) {
var count = 0;
function internalCallback(err, data) {
if (err && count < config.count) {
count++;
fn(internalCallback);
} else {
callback(err, data);
}
}
fn(internalCallback);
}
return {

@@ -70,3 +86,4 @@ retry: function (count) {

execute: execute.bind(null, config),
executeForPromise: executeForPromise.bind(null, config)
executeForPromise: executeForPromise.bind(null, config),
executeForNode: executeForNode.bind(null, config)
};

@@ -73,0 +90,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet