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

superagent-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent-as-promised - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

42

index.coffee.md
SuperAgent as Promised
======================
Request = require 'superagent'
Promise = require 'bluebird'

@@ -9,23 +8,22 @@

Request.Request.prototype.endAsync = ->
new Promise (resolve,reject) =>
try
@end (error, response) ->
if error
reject error
return
if response.error
reject response.error
return
resolve response
catch error
reject error
module.exports = (Request) ->
Request.Request.prototype.endAsync = ->
new Promise (resolve,reject) =>
try
@end (error, response) ->
if error
reject error
return
if response.error
reject response.error
return
resolve response
catch error
reject error
Request.Request.prototype.then = ->
@endAsync()
.then arguments...
Request.Request.prototype.catch = ->
@endAsync()
.catch arguments...
module.exports = Request
Request.Request.prototype.then = ->
@endAsync()
.then arguments...
Request.Request.prototype.catch = ->
@endAsync()
.catch arguments...

@@ -1,45 +0,41 @@

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
(function() {
var Promise, Request;
var Promise;
Request = require('superagent');
Promise = require('bluebird');
Request.Request.prototype.endAsync = function() {
return new Promise((function(_this) {
return function(resolve, reject) {
var error;
try {
return _this.end(function(error, response) {
if (error) {
reject(error);
return;
}
if (response.error) {
reject(response.error);
return;
}
return resolve(response);
});
} catch (_error) {
error = _error;
return reject(error);
}
};
})(this));
module.exports = function(Request) {
Request.Request.prototype.endAsync = function() {
return new Promise((function(_this) {
return function(resolve, reject) {
var error;
try {
return _this.end(function(error, response) {
if (error) {
reject(error);
return;
}
if (response.error) {
reject(response.error);
return;
}
return resolve(response);
});
} catch (_error) {
error = _error;
return reject(error);
}
};
})(this));
};
Request.Request.prototype.then = function() {
var ref;
return (ref = this.endAsync()).then.apply(ref, arguments);
};
return Request.Request.prototype["catch"] = function() {
var ref;
return (ref = this.endAsync())["catch"].apply(ref, arguments);
};
};
Request.Request.prototype.then = function() {
var _ref;
return (_ref = this.endAsync()).then.apply(_ref, arguments);
};
Request.Request.prototype["catch"] = function() {
var _ref;
return (_ref = this.endAsync())["catch"].apply(_ref, arguments);
};
module.exports = Request;
}).call(this);
{
"name": "superagent-as-promised",
"version": "2.0.0",
"version": "3.0.0",
"description": "SuperAgent with a Promise twist",

@@ -17,12 +17,12 @@ "main": "index.js",

"dependencies": {
"bluebird": "^2.3.11",
"superagent": "^0.21.0"
"bluebird": "^2.9.14"
},
"devDependencies": {
"chai": "^1.10.0",
"chai-as-promised": "^4.1.1",
"coffee-script": "^1.8.0",
"express": "^4.10.4",
"mocha": "^2.0.1"
"superagent": "^1.1.0",
"chai": "^2.1.2",
"chai-as-promised": "^4.3.0",
"coffee-script": "^1.9.1",
"express": "^4.12.3",
"mocha": "^2.2.1"
}
}

@@ -14,4 +14,7 @@ SuperAgent as Promise(d)

var request = require('superagent-as-promised');
var request = require('superagent');
require('superagent-as-promised')(request);
Then
request

@@ -18,0 +21,0 @@ .get('/location')

@@ -5,3 +5,4 @@ chai = require 'chai'

Request = require '..'
Request = require 'superagent'
(require '..') Request
express = require 'express'

@@ -8,0 +9,0 @@

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