# types_checker_23

> check javascript type

Latest version **1.0.4** (published 2019-11-19) · ISC license · 0 weekly downloads

## Install

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

## 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 |
| Published | 2019-11-19 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kingwei |
| Maintainers | kingwei |
| Keywords | check, javascript, type |

## Links

- npm: https://www.npmjs.com/package/types_checker_23
- Repository: https://github.com/caijw/typeCheck
- Homepage: https://github.com/caijw/typeCheck#readme
- Issues: https://github.com/caijw/typeCheck/issues
- npm.io page: https://npm.io/package/types_checker_23

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-11-19
- 1.0.3 — 2019-11-18
- 1.0.1 — 2019-11-18
- 1.0.0 — 2019-11-18

## README

# docs

数据类型校验

用法:

```js
const typeCheck = require("types_checker_23");
const assert = require("assert");

const check1 = {
  a: 12,
  b: {
    d: "23fsfs",
    f: true
  },
  c: [1, {
    s: "sdfsfsdfsdfsdfsdfsd"
  }]
};

const expect1 = {
  a: 0,
  b: {
    d: "",
    f: true
  },
  c: [0, {
    s: ""
  }]
};

const root1 = "root";

const res1 = typeCheck.check(check1, expect1, root1);

assert.strictEqual(res1, "");

const check2 = {
  a: 12,
  b: {
    d: "23fsfs",
    f: true
  },
  c: [1, {
    s: "sdfsfsdfsdfsdfsdfsd"
  }]
};

const expect2 = {
  a: 0,
  b: {
    d: "",
    f: true
  },
  c: [0, {
    s: 0
  }]
};

const root2 = "root";

const res2 = typeCheck.check(check2, expect2, root1);

assert.strictEqual(res2, `${root2}.c[1].s should be Number, not String;`);
```

## check 接口

会检测传入的数据和预期的数据是否符合，不符合返回不符合的信息

符合预期会返回一个空字符串

第一个参数是待检测的数据

第二个参数是预期的数据格式，每个key跟待检测数据对应，value是数据类型的值

第三个参数是返回信息的 root

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