2.0.6 • Published 5 years ago

@konata9/typecheck.js v2.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

typecheck

Really simple type check function tool with Pure JavaScript. Check varible type in JavaScript. Rewrited by TypeScript

Install

npm i @konata9/typecheck.js

Usage

require usage has benn changed!

import typecheck from '@konata9/typecheck.js';
// or
import { typeCheck } from '@konata9/typecheck.js';
// or
const { typecheck } = require('@konata9/typecheck.js');

const arr = [];
typecheck(arr); // array

typecheck(target)

The target is the varible you want to check. The return type string in table below.

typeexamplereturn
stringtypecheck("a")string
numbertypecheck(1)number
booleantypecheck(true)boolean
nulltypecheck(null)null
undefinedtypecheck(undefined)undefined
Objecttypecheck({})object
Arraytypecheck([])array
Settypecheck(new Set())set
Maptypecheck(new Map())map
Symoboltypecheck(Symbol())symbol
Functiontypecheck((a, b)=> a + b)function

Test

This module is tested by mocha. You can find the test case in test folder or run the test command below (You need full source on the github page).

npm run test
2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago