Skip to content

Type Check: string, number, boolean, null, undefined, object, function, regexp, HTMLElement

Notifications You must be signed in to change notification settings

LeeHyungGeun/wat-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Downloads Version

wat-type.js

function utils to check type : string, number, boolean, null, undefined, object, NaN, function, RegExp, HTMLElement

Install

npm i --save wat-type

How to use

ESM (Import/Export) / CommonJS

import watType from 'wat-type' // ESM
const watType = require('wat-type') // CommonJS

watType.watType(NaN) // NaN
watType.isString('LeeHyungGeun') // true
watType.isNumber(35) // true
watType.isBoolean(false) // true
watType.isNull(null) // true
watType.isUndefined(undefined) // true
watType.isNaN(NaN) // true
watType.isObject({}) // true
watType.isFunction(function() {}) // true
watType.isRegExp(/LeeHyungGeun/) // true

ES3

<script src="../dist/wat-type.js"></script>
<script>
watType.watType(NaN) // NaN
watType.isString('LeeHyungGeun') // true
watType.isNumber(35) // true
watType.isBoolean(false) // true
watType.isNull(null) // true
watType.isUndefined(undefined) // true
watType.isNaN(NaN) // true
watType.isObject({}) // true
watType.isFunction(function() {}) // true
watType.isRegExp(/LeeHyungGeun/) // true
watType.isHTMLElement(document.createElement('div')) // true
</script>

About

Type Check: string, number, boolean, null, undefined, object, function, regexp, HTMLElement

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published