Skip to content

Commit 8e8f96b

Browse files
committed
chore: format and update dependencies
1 parent a76e71d commit 8e8f96b

File tree

2 files changed

+170
-82
lines changed

2 files changed

+170
-82
lines changed

exercises/05.tuples/02.solution.tuple-patterns/index.test.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ await test('parseNumber should parse valid numbers correctly', () => {
77
const num = parseInt(str, 10)
88
return [num, !isNaN(num)]
99
}
10-
const parsed = parseNumber('42')
11-
const num1 = parsed[0]
12-
const success1 = parsed[1]
10+
const parsed = parseNumber('42')
11+
const num1 = parsed[0]
12+
const success1 = parsed[1]
1313
assert.strictEqual(
1414
num1,
1515
42,
16-
'🚨 num1 should be 42 - use index access to get the first tuple element (the parsed number)',
16+
'🚨 num1 should be 42 - use index access to get the first tuple element (the parsed number)',
1717
)
1818
assert.strictEqual(
1919
success1,
2020
true,
21-
'🚨 success1 should be true - use index access to get the second tuple element (the success flag)',
21+
'🚨 success1 should be true - use index access to get the second tuple element (the success flag)',
2222
)
2323
})
2424

@@ -27,9 +27,9 @@ await test('parseNumber should handle invalid numbers correctly', () => {
2727
const num = parseInt(str, 10)
2828
return [num, !isNaN(num)]
2929
}
30-
const parsed = parseNumber('hello')
31-
const num2 = parsed[0]
32-
const success2 = parsed[1]
30+
const parsed = parseNumber('hello')
31+
const num2 = parsed[0]
32+
const success2 = parsed[1]
3333
assert.strictEqual(
3434
isNaN(num2),
3535
true,
@@ -44,50 +44,50 @@ await test('parseNumber should handle invalid numbers correctly', () => {
4444

4545
await test('getMinMax should return correct min and max values', () => {
4646
function getMinMax(nums: Array<number>): [number, number] {
47-
let min = nums[0]
48-
let max = nums[0]
49-
for (const num of nums) {
50-
if (num < min) min = num
51-
if (num > max) max = num
52-
}
53-
return [min, max]
47+
let min = nums[0]
48+
let max = nums[0]
49+
for (const num of nums) {
50+
if (num < min) min = num
51+
if (num > max) max = num
52+
}
53+
return [min, max]
5454
}
55-
const minMax = getMinMax([5, 2, 8, 1, 9])
56-
const min = minMax[0]
57-
const max = minMax[1]
55+
const minMax = getMinMax([5, 2, 8, 1, 9])
56+
const min = minMax[0]
57+
const max = minMax[1]
5858
assert.strictEqual(
5959
min,
6060
1,
61-
'🚨 min should be 1 - use index access to get the first tuple element (minimum value)',
61+
'🚨 min should be 1 - use index access to get the first tuple element (minimum value)',
6262
)
6363
assert.strictEqual(
6464
max,
6565
9,
66-
'🚨 max should be 9 - use index access to get the second tuple element (maximum value)',
66+
'🚨 max should be 9 - use index access to get the second tuple element (maximum value)',
6767
)
6868
})
6969

7070
await test('getMinMax should work with different number arrays', () => {
7171
function getMinMax(nums: Array<number>): [number, number] {
72-
let min = nums[0]
73-
let max = nums[0]
74-
for (const num of nums) {
75-
if (num < min) min = num
76-
if (num > max) max = num
77-
}
78-
return [min, max]
72+
let min = nums[0]
73+
let max = nums[0]
74+
for (const num of nums) {
75+
if (num < min) min = num
76+
if (num > max) max = num
77+
}
78+
return [min, max]
7979
}
80-
const minMax = getMinMax([10, 20, 5, 15])
81-
const min = minMax[0]
82-
const max = minMax[1]
80+
const minMax = getMinMax([10, 20, 5, 15])
81+
const min = minMax[0]
82+
const max = minMax[1]
8383
assert.strictEqual(
8484
min,
8585
5,
86-
'🚨 min should be 5 - use a loop to find the minimum value in the array',
86+
'🚨 min should be 5 - use a loop to find the minimum value in the array',
8787
)
8888
assert.strictEqual(
8989
max,
9090
20,
91-
'🚨 max should be 20 - use a loop to find the maximum value in the array',
91+
'🚨 max should be 20 - use a loop to find the maximum value in the array',
9292
)
9393
})

0 commit comments

Comments
 (0)