# yarp

> Yet Another Request-Promise - Overly-simple promise wrapper around the amazing request module

Latest version **1.0.0** (published 2016-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install yarp
pnpm add yarp
yarn add yarp
bun add yarp
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-12-19 |
| First published | 2014-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Powell Kinney |
| Maintainers | pkinney |
| Keywords | request, http, rest, promise, q |

## Links

- npm: https://www.npmjs.com/package/yarp
- Repository: https://github.com/dialexa/yarp
- Issues: https://github.com/dialexa/yarp/issues
- npm.io page: https://npm.io/package/yarp

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.2
- [request](https://npm.io/package/request.md) ^2.58.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.6

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-12-19
- 0.4.6 — 2016-08-24
- 0.4.5 — 2015-12-04
- 0.4.4 — 2015-07-02
- 0.4.3 — 2015-07-02
- 0.4.2 — 2015-05-24
- 0.4.1 — 2015-04-29
- 0.4.0 — 2015-04-29
- 0.3.0 — 2015-03-21
- 0.2.0 — 2014-12-01
- 0.1.1 — 2014-12-01

## README

YARP (Yet Another Request-Promise)
==================================

[![npm version](https://badge.fury.io/js/yarp.svg)](http://badge.fury.io/js/yarp)
[![Build Status](https://travis-ci.org/dialexa/yarp.svg)](https://travis-ci.org/dialexa/yarp)

There is a glut of promise-based wrappers around the awesome `request` module (https://github.com/request/request).

This is yet another one.

Overly Simple:

```javascript
var yarp = require('yarp');

yarp({
  method: 'GET',
  url: 'http://jsonplaceholder.typicode.com/users',
}).then(function(resp){           // resolves if statusCode < 400
  console.log(resp);
}).catch(function(err){           // rejects with object otherwise
  if(err.statusCode) {            // server responded with statusCode >= 400
    console.log(err.statusCode);
    console.log(err.message);     // if the server gave a message as part of its response
    console.log(err.data);        // the data received from the server (if present)
    console.log(err.request);     // the original request options
  } else {
    console.log(err)              // internal client error
  }
}).done();
```

As of 0.4.0, you can now pass `true` as a second parameter to have all responses treated as resolution:

```javascript
var yarp = require('yarp');

yarp({
  method: 'GET',
  url: 'http://jsonplaceholder.typicode.com/users',
}, true).then(function(resp){     // resolves for any status code
  console.log(resp.statusCode);   // status code from the response
  console.log(resp.data)          // response from the servdr, parsed if valid JSON
  console.log(resp.body)          // raw response
}).catch(function(err){
  console.log(err)                // rejects with internal client error
}).done();
```

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