photo_server_json_flutter_c.../api_v1/scanner/t.js
2026-03-11 11:31:52 +01:00

36 lines
1 KiB
JavaScript

// idsIndex-test.js
// Questa è la stessa funzione che usi nel tuo programma
function removeIdFromList(idsIndex, id) {
return idsIndex.filter(x => x !== id);
}
// Simuliamo idsIndex come lo costruisce il tuo programma:
// un array di stringhe (ID)
const idsIndex = [
"b3cda38a2fdee7ba9bdd2ea07d936b2fa5361baa21be2b2c29f1ad8ebcc4c31e",
"09ef919ff2a105ad75d2e7631b9c02228c1784df5048c98276fd379f1533360b",
"dba1de0e187650e62118279beb2d83e8759a6d4fb8a5412a6a18cdc4e01a33d7"
];
// Prendiamo il primo ID
const idToRemove = idsIndex[0];
// LOG iniziali
console.log("=== TEST RIMOZIONE ID ===");
console.log("idsIndex iniziale:", idsIndex);
console.log("ID da rimuovere:", idToRemove);
console.log("--------------------------");
// Rimozione
const newList = removeIdFromList(idsIndex, idToRemove);
// LOG finali
console.log("idsIndex dopo removeIdFromList:", newList);
// Verifica manuale
if (newList.includes(idToRemove)) {
console.log("❌ ERRORE: l'ID NON è stato rimosso!");
} else {
console.log("✅ OK: l'ID è stato rimosso correttamente.");
}