#314·co

isGenerator 和 isObject 函数存在一些不合适的地方

作者: waterVenice7创建于 2017年3月3日更新于 2020年1月14日

function isGenerator(obj) { return 'function' == typeof obj.next && 'function' == typeof obj.throw; } 为什么不使用 toString.call(obj) === '[object Generator]' 来替换呢?我认为这是一种比默认方式更明确的判断方法;