Weboob scripts improvements
The sorting of the existing banks.json has been done with the following script:
let fs = require('fs');
let json = JSON.parse(fs.readFileSync('./banks.json'));
let newJson = [];
for (let entry of json) {
if (entry.customFields) {
for (let cf of entry.customFields) {
if (cf.type === 'select') {
cf.values.sort((a, b) => {
if (a.value < b.value) {
return -1
}
if (a.value === b.value) return 0;
return 1
})
}
}
entry.customFields.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name === b.name) return 0
return 1
});
}
newJson.push(entry);
}
fs.writeFileSync('./banks.json', JSON.stringify(newJson, null, 4))