# fetch-interceptors

> Wrap JavaScript's `fetch()` to add response interceptors.

Latest version **0.1.1** (published 2018-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install fetch-interceptors
pnpm add fetch-interceptors
yarn add fetch-interceptors
bun add fetch-interceptors
```

## 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.1.1 |
| Published | 2018-05-24 |
| First published | 2018-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tyrone Tudehope |
| Maintainers | johnnynotsolucky |

## Links

- npm: https://www.npmjs.com/package/fetch-interceptors
- Repository: https://github.com/johnnynotsolucky/fetch-interceptors
- Homepage: https://github.com/johnnynotsolucky/fetch-interceptors#readme
- Issues: https://github.com/johnnynotsolucky/fetch-interceptors/issues
- npm.io page: https://npm.io/package/fetch-interceptors

## Recent versions

- 0.1.1 (latest) — 2018-05-24
- 0.1.0 — 2018-05-24

## README

# fetch() Response Interceptors

Wrap JavaScript's `fetch()` to add response interceptors.

```javascript
import withInterceptors from 'fetch-interceptors'

const wrappedFetch = withInterceptors(
  fetch,
  ({ request, ...response }) => {
    return {
      ...response,
      // moar props
    }
  },
  response => {
    // 🤒
    return response
  }
)

wrappedFetch('https://httpbin.org/get?foo=bar')
  .then(response => {
    console.log(response)
    // { "foo": "bar" }
  })
```

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