weitypeprod
v1.1.1
Published
Check JS data type
Downloads
8
Readme
使用
- 检测数据类型,简单数据类型和对象数据类型
- 还可以传递第二个参数,true则保证得到的结果是Object.prototype.toString如 [object B]B的值
- 如果是自定义对象,则是拿到构造函数的name
import type from 'weitypeprod'
// console.log(type)
let s =type('sss')
console.log(s)//string
class Person {}
let personChild =new Person
console.log(weiType(personChild))//person
console.log(weiType(personChild,true))//Person
let arr =[]
console.log(type(arr))//array
let date =new Date()
console.log(type(date))//date
function fun (){}
console.log(type(fun))//function