-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Description
Hey there, you should change the code in order to cover this requirement: if prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property.
Something like the following should work:
function updateRecords(id, prop, value) {
if (value === '') {
delete collection[id][prop];
} else if (prop !== 'tracks') {
collection[id][prop] = value;
} else {
!collection[id].hasOwnProperty('tracks') ? collection[id][prop] = []
: collection[id][prop];
collection[id][prop].push(value);
}
return collection;
}pynchmeister
Metadata
Metadata
Assignees
Labels
No labels