Update assignWithDepth.ts

This commit is contained in:
Reda Al Sulais
2023-08-11 19:54:37 +03:00
committed by GitHub
parent d8dd68cad2
commit c37c494a1e

View File

@@ -28,9 +28,9 @@
const assignWithDepth = (
dst: any,
src: any,
{ depth = 2, clobber = false }: { depth: number; clobber: boolean } = { depth: 2, clobber: false }
{ depth = 2, clobber = false }: { depth?: number; clobber?: boolean } = {}
): any => {
const config = Object.assign({ depth, clobber });
const config: { depth: number; clobber: boolean } = { depth, clobber };
if (Array.isArray(src) && !Array.isArray(dst)) {
src.forEach((s) => assignWithDepth(dst, s, config));
return dst;