Skip to content

Commit

Permalink
destructure parameters (#2507)
Browse files Browse the repository at this point in the history
* destructure parameteres

* add missing .
  • Loading branch information
ConeDragon authored Jul 24, 2024
1 parent 5de2c23 commit 00685d6
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
*
* @returns {Card} the first card in the deck
*/
export function getFirstCard(deck) {
const [first] = deck;

export function getFirstCard([first]) {
return first;
}

Expand All @@ -21,9 +19,7 @@ export function getFirstCard(deck) {
*
* @returns {Card} the second card in the deck
*/
export function getSecondCard(deck) {
const [, second] = deck;

export function getSecondCard([, second]) {
return second;
}

Expand All @@ -46,9 +42,7 @@ export function swapTopTwoCards([a, b, ...rest]) {
* @returns {[Card, Card[]]} the top card of the given
* deck and a new deck containing all the other cards
*/
export function discardTopCard(deck) {
const [first, ...rest] = deck;

export function discardTopCard([first, ...rest]) {
return [first, rest];
}

Expand Down

0 comments on commit 00685d6

Please sign in to comment.