- estrazione dei dati del libro sul sito di Amazon.
- possibilità di visualizzare i dati estratti e di aggiornare i dati, sia solo se vuoti, che sovrascrivere tutti i dati.
This commit is contained in:
@@ -10020,6 +10020,24 @@ export const tools = {
|
||||
return addstr;
|
||||
},
|
||||
|
||||
generateHtmlTableFromObject(obj: object) {
|
||||
if (!obj || typeof obj !== 'object') return '';
|
||||
|
||||
let html = '<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse;">';
|
||||
html += '<thead><tr><th>Chiave</th><th>Valore</th></tr></thead><tbody>';
|
||||
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
// Se il valore è un oggetto o array, lo converto in JSON stringa
|
||||
const displayValue = value && typeof value === 'object' ? JSON.stringify(value) : String(value);
|
||||
|
||||
html += `<tr><td>${key}</td><td>${displayValue}</td></tr>`;
|
||||
}
|
||||
|
||||
html += '</tbody></table>';
|
||||
return html;
|
||||
},
|
||||
|
||||
|
||||
|
||||
// FINE !
|
||||
|
||||
|
||||
Reference in New Issue
Block a user