mdn / mdn/browser-compat-data

Naming conventions for properties in returned objects

Open
#13,834 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

data:api docs:guidelines
Dominant language
JSON
Stars
5.8k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
186

Description

In #12840, @ddbeck and @foolip had been discussing a convention for the properties in the objects returned by certain methods. Quoting the conversation here:

Since we don't have a guideline, maybe this is an opportunity to start from scratch? How about returns_audioCapabilities_property with the idea being that we could have a convention for object properties (like this one), types (like returns_DOMMatrix_type), and values (like returns_undefined_value).

We should probably put the word return in the description too. Returns <code>audioCapabilities</code> property?

Originally posted by @ddbeck in https://github.com/mdn/browser-compat-data/pull/12840#discussion_r752159554

More ideas on these lines, to cut down on the wordiness:

  • audioCapabilities in return value object
  • audioCapabilities in returned object
  • Returns object with audioCapabilities
  • Returns object with audioCapabilities property

Originally posted by @ddbeck in https://github.com/mdn/browser-compat-data/pull/12840#discussion_r760983814

This made me think of the possibility of %parameter%_property_returned as the standard key, if that sounds nice?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by reading issue #12840 and the quoted discussion about returned-object properties, then identify the existing conventions and affected keys; done means the naming convention is settled and its scope is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
data
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.