# mockz

> generate chinese province,city,county,address.

Latest version **1.0.2** (published 2018-09-09) · MIT license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2018-09-09 |
| First published | 2018-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 347.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | blackmatch |
| Maintainers | blackmatch |
| Keywords | chinese, provice, city, district |

## Links

- npm: https://www.npmjs.com/package/mockz
- Repository: https://github.com/blackmatch/mockz
- Homepage: https://github.com/blackmatch/mockz#readme
- Issues: https://github.com/blackmatch/mockz/issues
- npm.io page: https://npm.io/package/mockz

## Dependencies (9)

- [chai](https://npm.io/package/chai.md) ^4.1.2
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [moment](https://npm.io/package/moment.md) ^2.22.2
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.2
- [request](https://npm.io/package/request.md) ^2.88.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.2
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.4.24
- [bufferhelper](https://npm.io/package/bufferhelper.md) ^0.2.1

## Recent versions

- 1.0.2 (latest) — 2018-09-09
- 1.0.1 — 2018-09-09
- 1.0.0 — 2018-09-09

## README

# mockz

随机获取中国的`省级`、`市级`、`县级`行政单位名称，灵感来自于[mockjs](https://github.com/nuysoft/Mock/tree/refactoring)。数据是从国家统计局获取的，目前的数据标准为：**[2017年统计用区划代码和城乡划分代码(截止2017年10月31日)](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2017/index.html)**。

## 使用方法

* 安装`mockz`

```shell
npm install mockz
```

* 使用示例

```js
const mockz = require('mockz');

// 全部数据
const all = mockz.all();
console.log(all[0]);

// 随机获取一个省级单位
const province = mockz.province();
console.log(province);  // 山西省

// 随机获取一个市级单位
const city = mockz.city();
console.log(city);  // 咸阳市

// 随机获取某个省的一个市级单位
const city2 = mockz.city('广东省');
console.log(city2);  // 潮州市

// 随机获取一个县级单位
const county = mockz.county();
console.log(county);  // 怀柔区

// 随机获取某个省的一个县级单位
const county2 = mockz.county('广东省');
console.log(county2);  // 蕉岭县

// 随机获取某个省某个市的一个县级单位
const county3 = mockz.county('广东省', '广州市');
console.log(county3);  // 天河区

// 随机获取一个地址
const address = mockz.address();
console.log(address); // 山西省晋中市昔阳县
```

## 声明

本项目仅用于学习研究，严禁用于其他非法用途。如果造成任何法律责任，与本人无关。

## 协议

MIT.

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