# slim-fetchy

> fetch json-enhanced api (ES6) - using isomorphic-fetch lib

Latest version **1.1.0** (published 2016-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install slim-fetchy
pnpm add slim-fetchy
yarn add slim-fetchy
bun add slim-fetchy
```

## 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.1.0 |
| Published | 2016-10-04 |
| First published | 2016-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Dan Levy |
| Maintainers | justsml |

## Links

- npm: https://www.npmjs.com/package/slim-fetchy
- Repository: https://github.com/justsml/slim-fetchy
- Issues: https://github.com/justsml/slim-fetchy/issues
- npm.io page: https://npm.io/package/slim-fetchy

## Dependencies (1)

- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1

## Recent versions

- 1.1.0 (latest) — 2016-10-04
- 1.0.6 — 2016-09-20
- 1.0.5 — 2016-09-20
- 1.0.4 — 2016-09-20
- 1.0.3 — 2016-09-20
- 1.0.2 — 2016-05-15
- 1.0.1 — 2016-05-15
- 1.0.0 — 2016-05-13

## README

# slim-fetchy 🚀

Enhanced `fetch` API.

https://github.com/justsml/slim-fetchy.git

* ✔ Simple HTTP request
* ✔ Small
* ✔ Encode POST Body
* ✔ Response parser
* ✔ Smarter error handling

## Why?

I was listening to Slim Shady EP.
And all the other names were taken.

## Install

```sh
# Add to your project:
npm install slim-fetchy --save

# Optionally, clone Code:
git clone https://github.com/justsml/slim-fetchy.git
cd slim-fetchy
npm install
npm test
```

## Seriously, Why?

The current [`fetch` API spec](https://fetch.spec.whatwg.org/)
and the [implementation from Github](https://github.github.io/fetch/) are ill-suited for the majority of use-cases.

Specifically, JSON-backed services require repetitive encoding and response parsing.
Additionally, acquiring HTTP response *body content* requires 2 promise `.then()` calls.
*(Some Promise libraries, like [bluebird](https://github.com/petkaantonov/bluebird) will automatically handle this for you.)*

I decided to create a wrapper to eliminate frequent hurdles &amp; repetitive code.

#### slim-fetchy JSON optimized usage:
```js
// Using slim-fetchy (optional: es6 destructuring)
fetch('/users.json')
  .then(({body}) => {
    document.body.innerHTML = body; // SINGLE `.then` - has access to headers, status & statusText
  })
```

#### Compared to current fetch API/spec:

```js
// Using github's implementation
fetch('/users.json')
  .then(function(response) {
    return response.text()
  }).then(function(body) {
    document.body.innerHTML = body
  })
```

## Stats & Support Info

* Requires `Promise` support - native or polyfilled. Tested with [Bluebird](https://www.npmjs.com/package/bluebird) and [es6-promise](https://www.npmjs.com/package/es6-promise)
* Runs on: **Browser &amp; NodeJS**
* Gzipped: 2.8K

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