blob: fbf1543067c766eea3125d378e8ca05fc93eced7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
export function denormalize(state, objectType, id) {
const object = Object.assign({}, state.objects[objectType][id]);
for (let prop in object) {
if (!object.hasOwnProperty(prop)) {
continue;
}
if (prop.endsWith("Id")) {
const propType = prop.replace("Id", "");
object[propType] = state.objects[propType][object[prop]];
}
}
return object;
}
|