summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js')
-rw-r--r--node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js b/node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js
new file mode 100644
index 0000000..6740572
--- /dev/null
+++ b/node_modules/@jet-app/app-store/tmp/src/foundation/util/objects.js
@@ -0,0 +1,33 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+/**
+ * Created by km on 3/6/17.
+ */
+/**
+ * Creates and returns a shallow copy of a given object.
+ * @param object The object to create a shallow copy of.
+ * @returns The new copy of object.
+ */
+export function shallowCopyOf(object) {
+ if (object === null || object === undefined) {
+ return object;
+ }
+ const copy = Object.create(Object.getPrototypeOf(object));
+ Object.assign(copy, object);
+ return copy;
+}
+/**
+ * Returns whether or not a given object is an instance of
+ * a specified type, modifying the type of the object in
+ * TypeScript's type system.
+ *
+ * Prefer this function to using `instanceof` directly as it
+ * will retype the passed in object if the check succeeds.
+ *
+ * @param object The object whose nominal type will be checked.
+ * @param type The metatype that `object` is expected to be an instance of.
+ * @returns Whether object is an instance of type, updating the type of object accordingly.
+ */
+export function isTypeOf(object, type) {
+ return object instanceof type;
+}
+//# sourceMappingURL=objects.js.map \ No newline at end of file