# @jsmini/type

> 类型检测库，弥补typeof的问题

Latest version **0.12.0** (published 2025-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jsmini/type
pnpm add @jsmini/type
yarn add @jsmini/type
bun add @jsmini/type
```

## Health

**Score 40/100 (D)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.12.0 |
| Published | 2025-01-22 |
| First published | 2018-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 0 |
| Unpacked size | 27.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 64 |
| Author | yanhaijing |
| Maintainers | yanhaijing |
| Keywords | type, typeof |

## Links

- npm: https://www.npmjs.com/package/@jsmini/type
- Repository: https://github.com/jsmini/type
- Homepage: https://github.com/jsmini/type#readme
- Issues: https://github.com/jsmini/type/issues
- npm.io page: https://npm.io/package/@jsmini/type

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

- 0.12.0 (latest) — 2025-01-22
- 0.11.0 — 2023-11-21
- 0.10.0 — 2023-09-23
- 0.9.2 — 2019-10-09
- 0.9.1 — 2019-10-05
- 0.9.0 — 2019-10-02
- 0.8.1 — 2019-10-02
- 0.8.0 — 2019-06-11
- 0.7.0 — 2019-03-02
- 0.6.0 — 2018-10-22
- 0.5.0 — 2018-10-22
- 0.4.1 — 2018-10-10
- 0.4.0 — 2018-04-08

## README

# [type](https://github.com/jsmini/type)

[![](https://img.shields.io/badge/Powered%20by-jslib%20base-brightgreen.svg)](https://github.com/yanhaijing/jslib-base)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jsmini/type/blob/master/LICENSE)
[![CI](https://github.com/jsmini/type/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jsmini/type/actions/workflows/ci.yml)
[![npm](https://img.shields.io/badge/npm-0.12.0-orange.svg)](https://www.npmjs.com/package/@jsmini/type)
[![NPM downloads](http://img.shields.io/npm/dm/@jsmini/type.svg?style=flat-square)](http://www.npmtrends.com/@jsmini/type)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/jsmini/type.svg)](http://isitmaintained.com/project/jsmini/type 'Percentage of issues still open')

type checking library. fixed the problem of typeof. support IE6.

English | [简体中文](./README-zh_CN.md)

## Environment Support

unit test ensure it supports the following environments.

| IE/Edge | Chrome | Firefox | Safari | Opera | IOS | Android | Node  |
| ------- | ------ | ------- | ------ | ----- | --- | ------- | ----- |
| 6+      | 23+    | 4+      | 6+     | 10+   | 5+  | 2.3+    | 0.10+ |

## Directory

```
.
├── demo
├── dist  # production code
├── doc   # document
├── src   # source code
├── test  # unit test
├── CHANGELOG.md
└── TODO.md
```

## Usage

npm installation

```bash
$ npm install --save @jsmini/type
```

Node.js

```js
var type = require('@jsmini/type').type;

type(1); // 'number'
type(true); // 'boolean'
```

webpack

```js
import { type } from '@jsmini/type';

type(1); // 'number'
type(true); // 'boolean'
```

Require.js

```js
requirejs(
  ['node_modules/@jsmini/type/dist/index.aio.js'],
  function (jsmini_type) {
    var type = jsmini_type.type;

    type(1); // 'number'
    type(true); // 'boolean'
  },
);
```

Browser

```html
<script src="node_modules/@jsmini/type/dist/index.aio.js"></script>

<script>
  var type = jsmini_type.type;

  type(1); // 'number'
  type(true); // 'boolean'
</script>
```

## Document

[API](https://github.com/jsmini/type/blob/master/doc/api.md)

## Contributing Guide ![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)

when initialize, install dependencies

```bash
$ npm install
```

builds your code for production to `build` folder

```bash
$ npm run build
```

run unit test. notice: borwser enviroment need to test manually. test file is in `test/browser`

```bash
$ npm test
```

change the version in package.json and README.md, add your description in CHANGELOG.md, and then release it happily.

```bash
$ npm run release
```

publish the new package to npm

```bash
$ npm publish
```

## CHANGELOG

[CHANGELOG.md](https://github.com/jsmini/type/blob/master/CHANGELOG.md)

## TODO

[TODO.md](https://github.com/jsmini/type/blob/master/TODO.md)

## who is using

- [is](https://github.com/jsmini/is)
- [querystring](https://github.com/jsmini/querystring)
- [clone](https://github.com/jsmini/clone)
- [react-compare](https://github.com/fXy-during/react-compare)
- [z](https://github.com/PinghuaZhuang/z)

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