summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorGavin Mogan <git@gavinmogan.com>2025-04-28 19:16:28 -0700
committerGavin Mogan <git@gavinmogan.com>2025-04-28 19:16:28 -0700
commit53e7e321d20cd7071ff617ecfcf42f6122020bcd (patch)
treea4221d098bddd2a95cb02f06ed74c846951b9aed /src/util
parent14041a319cace03cfc23c0a919ed81fb141f88ce (diff)
switch to 3rd party merge which doesn't mutate config
Diffstat (limited to 'src/util')
-rw-r--r--src/util/object.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/util/object.ts b/src/util/object.ts
deleted file mode 100644
index 1ecc89b..0000000
--- a/src/util/object.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Simple object check.
- */
-export function isObject(item: any) {
- return item && typeof item === "object" && !Array.isArray(item);
-}
-
-/**
- * Deep merge two objects.
- */
-export function deepMerge<T>(
- target: Record<any, any>,
- ...sources: Record<any, any>[]
-): T {
- if (!sources.length) return target;
- const source = sources.shift();
-
- if (isObject(target) && isObject(source)) {
- for (const key in source) {
- if (isObject(source[key])) {
- if (!target[key]) Object.assign(target, { [key]: {} });
- deepMerge(target[key], source[key]);
- } else {
- Object.assign(target, { [key]: source[key] });
- }
- }
- }
-
- return deepMerge(target, ...sources) as T;
-}