Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Static method naming #57

@acutmore

Description

@acutmore

With the new static based functions. I was wondering if there were alternatives to the groupBy name. Object.groupBy and Map.groupBy sounds a little like it operates on Object or Map as opposed to building them.

Background

The majority of static Object methods operate on an object argument:

  • getOwnPropertyDescriptor
  • getOwnPropertyDescriptors
  • getOwnPropertyNames
  • getOwnPropertySymbols
  • hasOwn
  • preventExtensions
  • seal
  • assign
  • defineProperties
  • defineProperty
  • freeze
  • getPrototypeOf
  • setPrototypeOf
  • isExtensible
  • isFrozen
  • isSealed
  • keys
  • entries
  • values

The static Object methods that create an object, Object.create and Object.fromEntries, are in the minority but use words that strongly convey that a new value is being created.

Suggestions

Some alternatives we came up with at Bloomberg:

  • Object.byGrouping
  • Object.fromGrouping
  • Object.groupFrom

Thoughts?

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