Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Conversation

@mxdvl
Copy link
Contributor

@mxdvl mxdvl commented Nov 27, 2023

What?

Refactor latestStatusFrom function, so it leverages the existing compareStatuses function.

Why?

Code reuse and simplification: there is now one source of truth for comparing statuses. Follow-up on #679

Tested by running the following manual tests:

console.assert(latestStatusFrom(['alpha', 'stable']) === 'stable')
console.assert(latestStatusFrom(['stable', 'alpha']) === 'stable')
console.assert(latestStatusFrom(['nope', 'invalid']) === null)

Note that v18 of Node and later come bundled with a test runner. See #681 for upgrade.

@mxdvl mxdvl force-pushed the mxdvl/refactor-status-order branch from d499148 to ee9b9c4 Compare November 27, 2023 23:57
@mxdvl mxdvl marked this pull request as ready for review November 28, 2023 09:25
@mxdvl mxdvl requested a review from a team as a code owner November 28, 2023 09:25
Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@camertron camertron merged commit ce6ba33 into primer:main Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants