(obj)
| 2 | import ncmList from './ncmList.json'; |
| 3 | |
| 4 | function parseObject(obj) { |
| 5 | const formatDate = (date) => { |
| 6 | const newDate = new Date(date.split('/').reverse()); |
| 7 | return newDate.toISOString().slice(0, 10); |
| 8 | }; |
| 9 | |
| 10 | const convertKeysToLowerCase = Object.fromEntries( |
| 11 | Object.entries(obj).map(([k, v]) => [k.toLowerCase(), v]) |
| 12 | ); |
| 13 | |
| 14 | const { |
| 15 | tipo_ato_ini: tipoAtoIni, |
| 16 | numero_ato_ini: numeroAtoIni, |
| 17 | ano_ato_ini: anoAtoIni, |
| 18 | data_inicio: dataInicio, |
| 19 | data_fim: dataFim, |
| 20 | ...rest |
| 21 | } = convertKeysToLowerCase; |
| 22 | |
| 23 | const newObj = { |
| 24 | ...rest, |
| 25 | data_inicio: formatDate(dataInicio), |
| 26 | data_fim: formatDate(dataFim), |
| 27 | tipo_ato: tipoAtoIni, |
| 28 | numero_ato: numeroAtoIni, |
| 29 | ano_ato: anoAtoIni, |
| 30 | }; |
| 31 | |
| 32 | return newObj; |
| 33 | } |
| 34 | |
| 35 | const fetchNcmListFromSefaz = async () => { |
| 36 | const url = |
no test coverage detected