File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ const { parseScan, validate } = require('./passports')
7
7
8
8
const answers = [ ]
9
9
10
- const part1 = ( ) => {
10
+ const scanPassports = ( ) => {
11
11
let recordBuffer = ''
12
12
let validCount = 0
13
+ let validWithFieldsCount = 0
13
14
let invalidCount = 0
14
15
let totalCount = 0
15
16
@@ -20,6 +21,9 @@ const part1 = () => {
20
21
if ( validate ( passport , false ) ) {
21
22
validCount ++
22
23
}
24
+ if ( validate ( passport ) ) {
25
+ validWithFieldsCount ++
26
+ }
23
27
} catch ( e ) {
24
28
invalidCount ++
25
29
if ( DEBUG ) {
@@ -49,7 +53,7 @@ const part1 = () => {
49
53
console . info ( 'Total passports found:' , totalCount )
50
54
console . info ( 'Invalid passports' , invalidCount )
51
55
answers . push ( validCount )
52
- answers . push ( part2 ( ) )
56
+ answers . push ( validWithFieldsCount )
53
57
54
58
answers . forEach ( ( ans , idx ) => {
55
59
console . info ( `-- Part ${ idx + 1 } --` )
@@ -61,8 +65,4 @@ const part1 = () => {
61
65
return validCount
62
66
}
63
67
64
- const part2 = ( ) => {
65
- return 'No answer yet'
66
- }
67
-
68
- part1 ( )
68
+ scanPassports ( )
You can’t perform that action at this time.
0 commit comments