# he-fetch

> 制作属于自己的请求模块 hh

Latest version **1.0.5** (published 2021-01-11) · MIT license · 0 weekly downloads

## Install

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

## 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.5 |
| Published | 2021-01-11 |
| First published | 2021-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | 何皇 |
| Maintainers | hehuang724 |
| Keywords | fetch, axios |

## Links

- npm: https://www.npmjs.com/package/he-fetch
- npm.io page: https://npm.io/package/he-fetch

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-01-11
- 1.0.4 — 2021-01-11
- 1.0.3 — 2021-01-11
- 1.0.2 — 2021-01-11
- 1.0.1 — 2021-01-11
- 1.0.0 — 2021-01-11

## README

# he-fetch polyfill

`fetch()` 函数用于请求接口,其中包含 fetch.get() / fetch.post() / fetch.push() / fetch.delete()。

## Installation

```
npm install he-fetch

const fetch = require('he-fetch');
```

### Importing

Importing will automatically polyfill `window.fetch` and related APIs:

```javascript
import 'he-fetch';
```

### GET JSON

```javascript
fetch.get('http://jsonplaceholder.typicode.com/users').then(res => {
  console.log(res.data);
});
```

### Post JSON

```javascript
var users = {
  name: 'name',
  age: 'age'
};

fetch.post('/users', users).then(res => console.log(res));
```

### PUT JSON

```javascript
var users = {
  name: 'name',
  age: 'age'
};

fetch.put('/users/:id', users).then(res => console.log(res));
```

### DELETE JSON

```javascript
var users = {
  name: 'name',
  age: 'age'
};

fetch.delete('/users/:id').then(res => console.log(res));
```

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