* Find the latest year with data for a given applicant * @param {string[]} applicantIDs - Applicant IDs in the form "displayName@year" * @returns {Promise } - Latest year or null if no data found
(applicantIDs = [])
| 263 | * @returns {Promise<number|null>} - Latest year or null if no data found |
| 264 | */ |
| 265 | function findLatestYearForApplicant(applicantIDs = []) { |
| 266 | const validYears = applicantIDs |
| 267 | .map(id => Number.parseInt(id.split('@')[1], 10)) |
| 268 | .filter(Number.isFinite); |
| 269 | return validYears.length > 0 ? Math.max(...validYears) : null; |
| 270 | } |
| 271 | |
| 272 | function metadataWithLatestYear(metadata) { |
| 273 | const result = metadata ?? {}; |
no outgoing calls
no test coverage detected