diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-15 14:36:37 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:03 +0200 |
| commit | 326b74fc39f63f47c71359276601ea93f7345dc6 (patch) | |
| tree | 692684391eef98b019c27ff48c6eefba504c4b88 /src/store | |
| parent | 653290da64e3d85f422d1f00407b74011999a5fa (diff) | |
Shrink buttons of experiment and simulation rows
Diffstat (limited to 'src/store')
| -rw-r--r-- | src/store/denormalizer.js | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/store/denormalizer.js b/src/store/denormalizer.js deleted file mode 100644 index e6583ae7..00000000 --- a/src/store/denormalizer.js +++ /dev/null @@ -1,30 +0,0 @@ -const EXCLUDED_IDENTIFIERS = [ - "objectId", - "googleId", -]; - -export function denormalize(state, objectType, id) { - return denormalizeWithRecursionCheck(state, objectType, id, undefined); -} - -function denormalizeWithRecursionCheck(state, objectType, id, previousType) { - const object = Object.assign({}, state.objects[objectType][id]); - - for (let prop in object) { - if (prop.indexOf(previousType) !== -1) { - continue; - } - - if (prop.endsWith("Id") && EXCLUDED_IDENTIFIERS.indexOf(prop) === -1) { - const propType = prop.replace("Id", ""); - object[propType] = denormalizeWithRecursionCheck(state, propType, object[prop], objectType); - } - - if (prop.endsWith("Ids")) { - const propType = prop.replace("Ids", ""); - object[propType + "s"] = object[prop].map(id => denormalizeWithRecursionCheck(state, propType, id, objectType)); - } - } - - return object; -} |
