摘要:
这里列出了原始类型,时间、正则、错误、数组、对象的克隆规则,其他的可自行补充 function clone(value, deep){ if(isPrimitive(value)){ return value } if (isArrayLike(value)) { //是类数组 value = Ar 阅读全文
posted @ 2020-01-19 15:01
入坑的H
阅读(327)
评论(0)
推荐(0)
摘要:
Object.assign = Object.assign || function(){ if(arguments.length == 0) throw new TypeError('Cannot convert undefined or null to object'); let target = 阅读全文
posted @ 2020-01-19 14:57
入坑的H
阅读(771)
评论(0)
推荐(0)
摘要:
function getRawType(value) { return Object.prototype.toString.call(value).slice(8, -1)}//getoRawType([]) ==> Array 阅读全文
posted @ 2020-01-19 14:55
入坑的H
阅读(1312)
评论(0)
推荐(0)
摘要:
function isObjectLike(value) { return value != null && typeof value == 'object';} 阅读全文
posted @ 2020-01-19 14:53
入坑的H
阅读(136)
评论(0)
推荐(0)
摘要:
function isObject(value) { let type = typeof value; return value != null && (type == 'object' || type == 'function');} 阅读全文
posted @ 2020-01-19 14:52
入坑的H
阅读(141)
评论(0)
推荐(0)
摘要:
function isPrimitive(value) { return isStatic(value) || typeof value 'symbol} 阅读全文
posted @ 2020-01-19 14:51
入坑的H
阅读(343)
评论(0)
推荐(0)
摘要:
function isStatic(value) { return( typeof value 'string' || typeof value 'number' || typeof value 'boolean' || typeof value 'undefined' || value null 阅读全文
posted @ 2020-01-19 14:50
入坑的H
阅读(186)
评论(0)
推荐(0)

浙公网安备 33010602011771号