Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Nov 1, 2024
1 parent a82c9cc commit 244d3be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/adapters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export function deepMerge(target: any, ...sources: any[]) {
return deepMerge(target, ...sources);
}

export function isMergeableObject(item: any) {
return item && typeof item === "object" && !Array.isArray(item);
export function isMergeableObject(item: unknown): item is Record<string, unknown> {
if (!item) return false
if (typeof item !== "object") return false
// ES6 class instances, Maps, Sets, Arrays, etc. are not considered mergeable
return Object.getPrototypeOf(item) === Object.prototype
}

0 comments on commit 244d3be

Please sign in to comment.