1function convertTableToObjects(table, skipLastColumn = false) { 2 const headers = Array.from(table.querySelectorAll('th')).map(th => th.textContent); 3 if (skipLastColumn) { 4 headers.pop(); // remove the last header from the headers array 5 } 6 const rows = Array.from(table.querySelectorAll('tbody tr')); 7 8 return rows.map(row => { 9 const data = Array.from(row.querySelectorAll('td')).map(td => td.textContent); 10 if (skipLastColumn) { 11 data.pop(); // remove the last item from the data array 12 } 13 return headers.reduce((obj, header, index) => ({ ...obj, [header]: data[index] }), {}); 14 }); 15 } 16 17 function prettifyDate(date) { 18 const dateObj = new Date(date); 19 const day = dateObj.getDate(); 20 const month = dateObj.toLocaleString("default", { month: "short" }); 21 const year = dateObj.getFullYear(); 22 let hours = dateObj.getHours(); 23 const minutes = dateObj.getMinutes(); 24 let period = "AM"; 25 26 // Convert 24-hour format to 12-hour format and determine AM/PM 27 if (hours >= 12) { 28 period = "PM"; 29 if (hours > 12) { 30 hours -= 12; 31 } 32 } 33 if (hours === 0) { 34 hours = 12; 35 } 36 37 // Pad single digit hours and minutes with leading zeros 38 const paddedHours = String(hours).padStart(2, '0'); 39 const paddedMinutes = String(minutes).padStart(2, '0'); 40 41 const formattedDate = `${day}-${month}-${year} ${paddedHours}:${paddedMinutes} ${period}`; 42 43 return formattedDate; 44} 45 46 function formatErrorMessage(message) { 47 if (typeof message == 'string') { 48 return message 49 } 50 51 else { 52 let messageString = '' 53 message.forEach(errorMessage => { 54 messageString += errorMessage + "\n" 55 }) 56 57 return messageString 58 } 59} 60 61function validatePlateNumber(plateNumber) { 62 const regex = /^[a-zA-Z0-9]+$/; // Only alphanumeric characters, one or more 63 return regex.test(plateNumber); // Test the plate number against the regex 64}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.