@suid/utils
Advanced tools
Comparing version 0.0.7 to 0.0.8
export declare function isPlainObject(item: unknown): item is Record<keyof any, unknown>; | ||
export interface DeepmergeOptions { | ||
clone?: boolean; | ||
sortKeys?: boolean; | ||
} | ||
export default function deepmerge<T>(target: T, source: unknown, options?: DeepmergeOptions): T; | ||
//# sourceMappingURL=deepmerge.d.ts.map |
export function isPlainObject(item) { | ||
return (item !== null && typeof item === "object" && item.constructor === Object); | ||
} | ||
function sortKeys(object, keys) { | ||
for (const key of keys) { | ||
const value = object[key]; | ||
delete object[key]; | ||
object[key] = value; | ||
} | ||
} | ||
export default function deepmerge(target, source, options = { clone: true }) { | ||
@@ -22,4 +29,6 @@ const output = options.clone ? { ...target } : target; | ||
}); | ||
if (options.sortKeys) | ||
sortKeys(output, Object.keys(source)); | ||
} | ||
return output; | ||
} |
{ | ||
"name": "@suid/utils", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Utils used by suid packages.", | ||
@@ -31,7 +31,9 @@ "keywords": [ | ||
"license": "MIT", | ||
"author": { | ||
"name": "Juanra GM", | ||
"email": "juanrgm724@gmail.com", | ||
"url": "https://github.com/juanrgm" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Juanra GM", | ||
"email": "juanrgm724@gmail.com", | ||
"url": "https://github.com/juanrgm" | ||
} | ||
], | ||
"files": [ | ||
@@ -43,3 +45,3 @@ "**/*.js", | ||
"dependencies": { | ||
"@suid/types": "0.0.6" | ||
"@suid/types": "0.0.7" | ||
}, | ||
@@ -46,0 +48,0 @@ "peerDependencies": { |
16243
35
325
+ Added@suid/types@0.0.7(transitive)
- Removed@suid/types@0.0.6(transitive)
Updated@suid/types@0.0.7