#314·co

there is something unsuitable about isGenerator and isObject function

Author: waterVenice7Created Mar 3, 2017Updated Jan 14, 2020
function isGenerator(obj) {
  return 'function' == typeof obj.next && 'function' == typeof obj.throw;
}

why not use toString.call(obj)==="[object Generator]" to replace that? I think this is a more definite judge solution than default way;

function isObject(val) {
  return Object == val.constructor;
}

val.constrctor could be rewrited, I suggest that we can use toString.call(val)==="[object Object]" to get a more explicit check;