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

SuperAgent with a Promise twist

  • 4.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7.9K
increased by21.3%
Maintainers
1
Weekly downloads
 
Created
Source

SuperAgent as Promise(d)

SuperAgent as Promise

Installation

npm install superagent-as-promised

Usage

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

Then

request
.get('/location')
.then( function(response) {
  console.log("Got "+response.text);
})
.catch( function(error) {
  console.dir(error);
})

is syntactic sugar for:

var promise = request
  .get('/location')
  .endAsync();

promise
  .then( function(response) {
    console.log("Got "+response.text);
  })
  .catch( function(error) {
    console.dir(error);
  })

Options

require('superagent-as-promised')(SuperAgent,Promise);

SuperAgent must be a SuperAgent class; it is extended with endAsync(), then, and catch methods. The optional Promise parameter allows you to provide your own Promise class; bluebird is used by default.

Keywords

FAQs

Package last updated on 15 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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