redeclare config parameter add default value for each variable

This commit is contained in:
Reda Al Sulais
2023-08-11 01:39:04 +03:00
parent d5f11fc80a
commit d8dd68cad2

View File

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