这是一个快速判断数据类型的 JavaScript 的库。
npm install is-what-is
// use in node.js
const iwi = require('is-what-is');
console.log(iwi.isArray([]));
console.log(iwi.isNumber(666));
// use in browser with module script
import {isArray} from 'is-what-is'
console.log(isArray([]))
console.log(isNumber([]))
isNull(value)
isUndefined(value)
isDefined(value)
isNullOrUndefined
isPrimitive(value)
isInfinity(value)
isEmpty(value)
isNumber(value)
isString(value)
isBoolean(value)
isBigInt(value)
isSymbol(value)
isObject(value)
isArray(value)
isArguments(value)
isFunction(value)
isRegExp(value)
isDate(value)
isMap(value)
isWeakMap(value)
isSet(value)
isWeakSet(value)
isError(value)
isPromise(value)
isBase64(value)
isHex(value)
isWindow(value)
isHTMLDocument(value)
isHTMLCollection(value)
isNodeList(value)