UNPKG

@monda/utils

Version:

常用处理函数

11 lines 369 B
/** * 处理复杂类型 * @param target * @param typeName { string } * @returns { boolean|string } */ export function typeOf (target , typeName = undefined) { const fullTypeText = Object.prototype.toString.apply(target) const targetType = /^\[object (\w+)]$/.exec(fullTypeText)[1].toLocaleLowerCase() return typeName ? typeName === targetType : targetType }