get(...) function that works on immutable and non-immutable objects.
@@ -692,6 +692,20 @@ export function clone(obj) {
throw new Error("Unable to copy obj! Its type isn't supported.");
}
+/**
+ * Returns a property of a given object, no matter whether
+ * it's a normal or an immutable-js object.
+ * @param obj
+ * @param property
+ */
+export function get(obj, property) {
+ if(obj.get) {
+ return obj.get(property);
+ } else {
+ return obj[property];
+ }
+}
+
/**
* Tries to look up a property-path on a nested object-structure.
* Where `obj.x.y` would throw an exception if `x` wasn't defined
