Skip to content

Justification for functionality beyond Object.keys(obj).length #11

@bakkot

Description

@bakkot

As I mentioned in plenary, I would like to better understand the motivation for supporting things other than the basic Object.keys(obj).length (and for that motivation to be documented in the readme). I don't think this proposal is ready for stage 2 until that's been done.

There's a few examples in this comment. Those examples are, in order:

  • devtools
  • a legitimate use to know if an object has symbol keys (though not the count)
  • devtools
  • devtools
  • Babel's object spread helper, which would be adequately served by getOwnPropertyDescriptors
  • just the second example again, minified and vendored
  • devtools
  • an equality method, which is actually using the full list of properties anyway
  • TypeScript's object spread helper, which would be adequately served by getOwnPropertyDescriptors
  • Angular's Object.defineProperties polyfill

This list of examples is not, in itself, convincing to me. Perhaps there are others, or some description of a case can we all agree is sufficiently common to warrant additional functionality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions