# mockutil

> a mockutil help mock easier

Latest version **1.0.4-0** (published 2018-05-21) · MIT license · 0 weekly downloads

## Install

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

## 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.4-0 |
| Published | 2018-05-21 |
| First published | 2018-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 128.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | h3llotom |
| Maintainers | h3llotom |

## Links

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

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [mockjs](https://npm.io/package/mockjs.md) ^1.0.1-beta3

## Recent versions

- 1.0.4-0 (latest) — 2018-05-21
- 1.0.3 — 2018-05-21
- 1.0.2 — 2018-05-21
- 1.0.1 — 2018-05-21
- 1.0.0 — 2018-05-21

## README

### A simple mockjs extended app

##### install

use npm:

``` stata
npm install mockutil -D
```

use yarn:

``` dockerfile
yarn add mockutil -D
```

##### use

 1. touch mock.json

``` json
[
  {
    "url": "test/lib1",
    "method":"post",
    "template":{
      "string":"post"
    }
  },
  {
    "url": "test/lib2",
    "method":"get",
    "template":{
      "string":"get"
    }
  }
]
```

 2. import mockutil

``` javascript
const MockUtil = require('mockutil');
const json = require('./test.json');
```

 3. Instantiate objects

``` javascript
const mockutil = new MockUtil(json);
```

 4. replace your fetch/axios/request with mockutil instance

``` javascript
mockutil.get('test/lib2').then(res => {
  // balabala
})
```

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