type-of
npm install @tinyfe/type-of@tinyfe/type-of> typeof the value.
``js
import typeOf, { includes, of, is, getTypeString } from '@tinyfe/type-of';
const type = typeOf({});
// instance
type.type(); // Object
type.includes(['Array', 'String']); // false
type.of(); // {}.constructor
type.is('Object'); // true
type.getTypeString(); // Object
// functions
includes(['Array', 'String'], {}); // false
of([]); // [].constructor
is('Object', {}); // true
getTypeString([]); // Array
`
`js`
$BUILD_IN = [
Object,
Function,
Array,
String,
Boolean,
Number,
Symbol,
Date,
RegExp,
Error,
];
实例函数, 实例化成 type-of 对象, input = typeOf(input)
实例调用 input.type()
函数式 includes([type1, type2, xxx], input)
实例调用 type.includes([type1, type2, xxx])
函数式 of(input)
实例调用 type.of()
函数式 is(typeString, input)
实例调用 type.is()
函数式 getTypeString(input)
实例调用 type.getTypeString()`