fix recursiveMap function

This commit is contained in:
casperlamboo 2018-02-15 12:12:04 +01:00
parent 7fd9220851
commit 1d4562e2df

View File

@ -15,7 +15,12 @@ export function recursiveMap(objects, reviver) {
if (typeof object === 'object') { if (typeof object === 'object') {
object = recursiveMap(object, reviver); object = recursiveMap(object, reviver);
} }
object = reviver(i, object) || object;
const newObject = reviver(i, object);
if (typeof newObject !== 'undefined') {
object = newObject;
}
newObjects[i] = object; newObjects[i] = object;
} }