Skip to content

there is something unsuitable about isGenerator and isObject function #314

@waterVenice7

Description

@waterVenice7
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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions