this repo has no description
1/* eslint-disable @typescript-eslint/no-explicit-any */
2/**
3 * Created by km on 3/6/17.
4 */
5/**
6 * Creates and returns a shallow copy of a given object.
7 * @param object The object to create a shallow copy of.
8 * @returns The new copy of object.
9 */
10export function shallowCopyOf(object) {
11 if (object === null || object === undefined) {
12 return object;
13 }
14 const copy = Object.create(Object.getPrototypeOf(object));
15 Object.assign(copy, object);
16 return copy;
17}
18/**
19 * Returns whether or not a given object is an instance of
20 * a specified type, modifying the type of the object in
21 * TypeScript's type system.
22 *
23 * Prefer this function to using `instanceof` directly as it
24 * will retype the passed in object if the check succeeds.
25 *
26 * @param object The object whose nominal type will be checked.
27 * @param type The metatype that `object` is expected to be an instance of.
28 * @returns Whether object is an instance of type, updating the type of object accordingly.
29 */
30export function isTypeOf(object, type) {
31 return object instanceof type;
32}
33//# sourceMappingURL=objects.js.map