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')
77
88const answers = [ ]
99
10- const part1 = ( ) => {
10+ const scanPassports = ( ) => {
1111 let recordBuffer = ''
1212 let validCount = 0
13+ let validWithFieldsCount = 0
1314 let invalidCount = 0
1415 let totalCount = 0
1516
@@ -20,6 +21,9 @@ const part1 = () => {
2021 if ( validate ( passport , false ) ) {
2122 validCount ++
2223 }
24+ if ( validate ( passport ) ) {
25+ validWithFieldsCount ++
26+ }
2327 } catch ( e ) {
2428 invalidCount ++
2529 if ( DEBUG ) {
@@ -49,7 +53,7 @@ const part1 = () => {
4953 console . info ( 'Total passports found:' , totalCount )
5054 console . info ( 'Invalid passports' , invalidCount )
5155 answers . push ( validCount )
52- answers . push ( part2 ( ) )
56+ answers . push ( validWithFieldsCount )
5357
5458 answers . forEach ( ( ans , idx ) => {
5559 console . info ( `-- Part ${ idx + 1 } --` )
@@ -61,8 +65,4 @@ const part1 = () => {
6165 return validCount
6266}
6367
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