Skip to content

Commit

Permalink
Update docs/style-guide.md
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Gibson <[email protected]>
  • Loading branch information
ben-allen and gibson042 authored Aug 7, 2024
1 parent 6c55edf commit ca8f07f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions docs/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,7 @@ For example, an array holding the time zone identifiers "Asia/Tokyo", "Asia/Ho_C
For an example of when *not* to use lexicographic order, consider an array holding calendar time scale units. This array could be ordered by descending magnitude as `["years", "months", "weeks", "days"]` or its reverse ascending magnitude as `["days", "weeks", "months", "years"]`, but should not use the lexicographic `["days", "months", "weeks", "years"]` order.

### `resolvedOptions`

:star2: *The `resolvedOptions` of `Intl` objects should appear with `locale` first, followed by properties guaranteed to exist that can be set via extension keys, followed by properties guaranteed to exist that are not set by extension keys, and then finally all properties that exist conditionally. Elements in each of these categories should appear in lexicographical order.* :star2:

Order of `resolvedOptions`:
1. `locale`
2. All properties (given in lexicographical order) that can be set by extension keys and that are guaranteed to exist
3. Properties (in lexicographical order) that are not set by extension keys and that are guaranteed to exist
4. All properties (in lexicographical order) that exist conditionally.
:star2: *Properties in the output from `resolvedOptions()` of an Intl object should start with `locale` and otherwise use lexicographic order. Deviations (such as those motivated by semantic order involving a subset of properties) must be documented.* :star2:
Spec changes that add properties should do so in accordance with this recommendation, rather than automatically placing them at the end—relative enumeration order of properties should remain stable over time, but there is no such expectation regarding adjacency.
#### Examples
`Object.keys(new Intl.Segmenter().resolvedOptions())` returns `[ 'locale', 'granularity' ]`. If support for the [Unicode BCP 47 U Extension "dx" key](https://unicode.org/reports/tr35/#UnicodeDictionaryBreakExclusionIdentifier) were added and exposed as `dictionaryBreakExcludedScripts`, that property would belong before `granularity`.

0 comments on commit ca8f07f

Please sign in to comment.