# json-filter2

> filter unexport key and value

Latest version **0.0.1** (published 2018-11-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install json-filter2
pnpm add json-filter2
yarn add json-filter2
bun add json-filter2
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-11-08 |
| First published | 2018-11-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | wanglihui.sjz@gmail.com |
| Maintainers | wanglihui |
| Keywords | json, filter |

## Links

- npm: https://www.npmjs.com/package/json-filter2
- Repository: https://github.com/wanglihui/json-filter
- Homepage: https://github.com/wanglihui/json-filter#readme
- Issues: https://github.com/wanglihui/json-filter/issues
- npm.io page: https://npm.io/package/json-filter2

## 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-11-08

## README

# json-filter
---


根据用户定义的数据结构过滤掉不需要的字段
例如，原始数据:
```
    let obj = {
        const obj = {
        id: 1,
        name: "wanglihui",
        password: "test",
        family: {
            first: 1,
            second: 'two'
        },
        birthday: new Date(),
        // willNull: null,
    };
```
现在只想返回, id 和family中的second，可以定义如下数据结构:
```
        const destObj = {
            id: 'number',
            family: {
                second: 'string'
            }
        }
```
最终拿到的结果是:
``` 
    {
        id: 1,
        family: {
            second: 'test'
        }
    }
```


### Usage
---

```
    npm install json-filter --save
```

### 返回数据结构定义
---

数据结构定义


| 定义是类型 | javascript类型 | 
|---|---|
| date | Date |
| boolean| boolean|
| number | number |
| string | string |
| ? | 允许此值为空,如 ?number|

其他当做对象处理

### test
---
mocha

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