# superagent-jsonp

> Wrap a sweet jsonp filling in a savoury superagent wrapper

Latest version **0.2.1** (published 2018-03-16) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install superagent-jsonp
pnpm add superagent-jsonp
yarn add superagent-jsonp
bun add superagent-jsonp
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2018-03-16 |
| First published | 2015-02-08 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | lamp |
| Maintainers | lamp |
| Keywords | jsonp, superagent |

## Links

- npm: https://www.npmjs.com/package/superagent-jsonp
- Repository: https://github.com/lamp/superagent-jsonp
- Issues: https://github.com/lamp/superagent-jsonp/issues
- npm.io page: https://npm.io/package/superagent-jsonp

## Dependencies (1)

- [superagent](https://npm.io/package/superagent.md) >=1.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.1 (latest) — 2018-03-16
- 0.2.0 — 2017-12-07
- 0.1.2 — 2017-11-17
- 0.1.1 — 2016-07-22
- 0.1.0 — 2016-07-09
- 0.0.7 — 2016-05-21
- 0.0.6 — 2015-10-06
- 0.0.5 — 2015-08-16
- 0.0.4 — 2015-07-28
- 0.0.3 — 2015-07-04
- 0.0.2 — 2015-02-08
- 0.0.1 — 2015-02-08

## README

# superagent-jsonp

[![CircleCI](https://circleci.com/gh/lamp/superagent-jsonp/tree/master.svg?style=svg)](https://circleci.com/gh/lamp/superagent-jsonp/tree/master)
[![bitHound Overall Score](https://www.bithound.io/github/lamp/superagent-jsonp/badges/score.svg)](https://www.bithound.io/github/lamp/superagent-jsonp)

Adds jsonp behaviour to superagent.

## To use with browserify

First install with npm

```npm i superagent-jsonp --save```

Then use like so;

```js
const superagent = require('superagent');
const jsonp = require('superagent-jsonp');
superagent.get('http://example.com/foo.json').use(jsonp).end(function(err, res){
  // everything is as normal
});
```

## To use with bower

First install:

```bower i superagent-jsonp --save```

Include it from your bower components in the usual way

Then use pretty much as you do above

```js
superagent.get('http://example.com/foo.json').use(superagentJSONP).end(function(err, res){
  // everything is as normal
});
```

## Available options for the jsonp function

- callbackParam: The name of the query parameter that contains the function name to call. Defaults to `callback`.
- callbackName: Optional. The name of the callback function
- timeout: How long to wait until this is considered to be an
  unsuccessful request.
  - Note: all unsuccessful requests are currently treated as 404s

### Usage

```js
superagent
  .get('http://example.com/obviously_404.json').use(jsonp({
      timeout: 3000,
      callbackName: 'someOtherName'
    })).end((err, response) => {
      // response => {}
      // err => new Error('404 NotFound')
    });
```

---
_Source: https://npm.io/package/superagent-jsonp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
