replaces for with reduce for counting tracks

This commit is contained in:
Guilherme Danno 2020-03-29 09:14:08 -03:00 committed by Aurélien Mino
parent f5e06bbb2a
commit 6b740328fc

View file

@ -373,10 +373,7 @@ var MBImport = (function() {
function searchParams(release) {
let params = [];
let totaltracks = 0;
for (let i = 0; i < release.discs.length; i++) {
totaltracks += release.discs[i].tracks.length;
}
const totaltracks = release.discs.reduce((acc, { tracks }) => acc + tracks.length, 0);
let release_artist = '';
for (let i = 0; i < release.artist_credit.length; i++) {
let ac = release.artist_credit[i];