From 63f42bb0e14282fac8cae71b5e973946d441170b Mon Sep 17 00:00:00 2001 From: Botaro Shinomiya Date: Sat, 21 Dec 2024 16:10:56 +0300 Subject: [PATCH] fix: test if defined or not in clone at toplevel --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index ccb88db..2c87303 100644 --- a/src/utils.js +++ b/src/utils.js @@ -29,11 +29,11 @@ function deepModify ( source, target ) { function clone(obj) { var ret = {}, key, val; + if ( obj === null || typeof obj === 'undefined' ) + return obj; for ( key in obj ) { if ( obj.hasOwnProperty( key ) ) { val = obj[ key ]; - if ( val === null || typeof val === 'undefined' ) - return val; if ( Array.isArray( val ) ) ret[ key ] = val.map( clone ); else if ( typeof val === 'object' )