# mock-script

Latest version **0.0.1** (published 2018-08-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install mock-script
pnpm add mock-script
yarn add mock-script
bun add mock-script
```

## 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.0.1 |
| Published | 2018-08-27 |
| First published | 2018-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | monsterooo |
| Keywords | mock, fake, json |

## Links

- npm: https://www.npmjs.com/package/mock-script
- Repository: https://github.com/monsterooo/mock-script
- Homepage: https://github.com/monsterooo/mock-script#readme
- Issues: https://github.com/monsterooo/mock-script/issues
- npm.io page: https://npm.io/package/mock-script

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.1 (latest) — 2018-08-27

## README

### mock-script

mock-script 使用JSON语法模板，为你快速生成mock数据

#### 基础使用方法

```javascript
var json = `
[
  "{{repeat(1, 4)}}",{
    province: "{{province()}}",
    city: "{{city()}}",
    country: "{{country()}}",
    name: "{{lastName()}}{{firstName()}}"
  }
]`;
var mock = new MockScript(json);
var result = mock.get();
console.log(JSON.stringify(result))
```

#### json模板语法

```
[
  "{{repeat(1, 10)}}",
  {
    province: "{{province()}}",
    city: "{{city()}}",
    country: "{{country()}}",
    name: "{{lastName()}}{{firstName()}}"
  }
]
```

生成后的数据

```json
[
  {"province":"北京市","city":"石家庄市","country":"东城区","name":"赵安超"},
  {"province":"天津市","city":"唐山市","country":"西城区","name":"钱远岑"}
]
```

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