Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

superagent-bluebird-promise

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent-bluebird-promise - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

17

index.js

@@ -88,3 +88,3 @@ // From https://gist.github.com/epeli/11209665

*
* Make superagent requests Promises/A+ conformant
* Make superagent requests Promises ES6 conformant
*

@@ -102,1 +102,16 @@ * Call .then([onFulfilled], [onRejected]) to register callbacks

};
/**
*
* Make superagent requests Promises ES6 conformant
*
* Call .catch([onRejected]) to register callback
*
* @method catch
* @param {function} [onRejected]
* @return {Bluebird.Promise}
*/
Request.prototype.catch = function() {
var promise = this.promise();
return promise.catch.apply(promise, arguments);
};

6

package.json
{
"name": "superagent-bluebird-promise",
"description": "Add promise support to superagent using Bluebird",
"version": "3.0.2",
"version": "4.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",

@@ -36,9 +36,9 @@ "bugs": {

"jshint": "^2.7.0",
"mocha": "^2.2.4",
"mocha": "^3.0.2",
"mocha-unfunk-reporter": "^0.4.0",
"pre-commit": "^1.0.6",
"sinon": "^1.14.1",
"superagent": "^1.2.0",
"superagent": "^2.2.0",
"underscore": "^1.8.3"
}
}

@@ -14,3 +14,3 @@ [![Build Status](https://img.shields.io/travis/KyleAMathews/superagent-bluebird-promise/master.svg?style=flat-square)](http://travis-ci.org/KyleAMathews/superagent-bluebird-promise)

## Usage
Simply require this package instead of `superagent`. Then you can call `.then()` instead of `.end()` to get a promise for your requests.
Simply require this package instead of `superagent`. Then you can call `.then()` or `.catch()` instead of `.end()` to get a promise for your requests.

@@ -20,2 +20,3 @@ ```javascript

// .then()
request.get('/an-endpoint')

@@ -27,2 +28,8 @@ .then(function(res) {

});
// .catch()
request.get('/an-endpoint')
.catch(function(error) {
console.log(error);
});
```

@@ -29,0 +36,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc