UNPKG

@muyi086/var-type

Version:
2 lines (1 loc) 761 B
var n=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var o=n((u,s)=>{var e=class{constructor(){this.typeList=["Null","Undefined","Object","Array","ArrayBuffer","String","Number","Boolean","Function","RegExp","Date","FormData","File","Blob","URLSearchParams","Set","WeakSet","Map","WeakMap"],this.init()}type(t){return Object.prototype.toString.call(t).match(/\[object (.*?)\]/)[1].toLowerCase()}init(){this.typeList.forEach(t=>{this["is"+t]=i=>this.type(i)===t.toLowerCase()})}isBuffer(t){return t!==null&&!this.isUndefined(t)&&t.constructor!==null&&!this.isUndefined(t.constructor)&&this.isFunction(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}isStream(t){return this.isObject(t)&&this.isFunction(t.pipe)}};s.exports=new e});export default o();