| 77 | |
| 78 | // Helper function for converting CSV rows to Protobuf types |
| 79 | const rowToProto = row => { |
| 80 | const values = row.split(','); |
| 81 | const convertedValues = values.map(value => { |
| 82 | if (Date.parse(value)) { |
| 83 | const date = new Date(value); |
| 84 | return { |
| 85 | dateValue: { |
| 86 | year: date.getFullYear(), |
| 87 | month: date.getMonth() + 1, |
| 88 | day: date.getDate(), |
| 89 | }, |
| 90 | }; |
| 91 | } else { |
| 92 | // Convert all non-date values to strings |
| 93 | return {stringValue: value.toString()}; |
| 94 | } |
| 95 | }); |
| 96 | return {values: convertedValues}; |
| 97 | }; |
| 98 | |
| 99 | async function deidentifyWithDateShift() { |
| 100 | // Read and parse a CSV file |
no test coverage detected