/**
* Get the raw type string of a value e.g. [object Object]
*/
function toRawType (value) {
return Object.prototype.toString.call(value).slice(8, -1)
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
function isPlainObject (obj) {
return toRawType(obj) === 'Object'
}
function isRegExp (v) {
return toRawType(v) === 'RegExp'
}
//上面这段代码核心就是 Object.prototype.toString,通过对此函数的包装达到类型判断的目的
检测key是否存在map中
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (str, expectsLowerCase) {
//先构造mapvar map = Object.create(null);
vue2工具函数阅读变量类型检测/** * Get the raw type string of a value e.g. [object Object] */function toRawType (value) { return Object.prototype.toString.call(value).slice(8, -1)}/** * Strict objec...