Skip to content

Commit

Permalink
Change ?? (ts-only) to || (js)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Nov 29, 2023
1 parent 7bc4902 commit 81a120a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rails-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ const statusOrder = [

/**
* Get the latest status, based on the order of precedence
*
*
* @param {readonly string[]} statuses list of status to pick from
* @returns {string | null} latest status if valid, `null` otherwise
*/
export const latestStatusFrom = (statuses) => {
return statuses
.filter(status => statusOrder.includes(status))
.sort(compareStatuses)
.at(-1) ?? null
.at(-1) || null
}

/**
* Compare function, which is compatible with #Array.sort.
*
*
* @param {string} first
* @param {string} second
* @returns {1 | 0 | -1} sorting order
Expand Down

0 comments on commit 81a120a

Please sign in to comment.