Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@jsmini/type

jsmini2.5kMIT0.12.0TypeScript support: included

类型检测库,弥补typeof的问题

type, typeof

readme

type

license CI npm NPM downloads Percentage of issues still open

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

English | 简体中文

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

$ npm install --save @jsmini/type

Node.js

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

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

webpack

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

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

Require.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

<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

Contributing Guide PRs welcome

when initialize, install dependencies

$ npm install

builds your code for production to build folder

$ npm run build

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

$ npm test

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

$ npm run release

publish the new package to npm

$ npm publish

CHANGELOG

CHANGELOG.md

TODO

TODO.md

who is using

changelog

Changelog

0.12.0 / 2024-5-1

  • Update jslib-base 3.0.6

0.11.0 / 2023-11-19

  • Upgrade jslib-base 2.3.2
  • Support sourceMap
  • Fix: Support node >=14.0.0

0.10.0 / 2023-09-23

  • Upgrade to the latest jslib-base
  • Support Node.js ESM

0.9.2 / 2019-10-10

  • Fix: Resolve the issue of missing d.ts

0.8.0 / 2019-6-11

  • In strict mode, return value of NaN changed from number to nan
  • In strict mode, return value of new Number(NaN) changed from Number to NaN

0.7.0 / 2019-3-2

  • Add .d.ts file to support ts calls

0.6.0 / 2018-10-22

  • Add strict mode, distinguish between primitive values and object values for numbers, strings, and booleans

0.5.0 / 2018-10-22

  • Add type support for new A, changed from unknown to A

0.4.1 / 2018-10-10

  • Fix the error of type(Object.create(null)) returning unknown

0.4.0 / 2018-4-6

  • Migrate project and change name

0.3.0 / 2018-3-32

  • Remove babel and special handling for symbol

0.2.0 / 2018-3-31

  • Native support for IE6-8

0.1.0 / 2018-3-17

  • Implement type