Skip to content

Commit

Permalink
fix: test if defined or not in clone at toplevel
Browse files Browse the repository at this point in the history
  • Loading branch information
citrizon committed Dec 21, 2024
1 parent 165bc4d commit 63f42bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down

0 comments on commit 63f42bb

Please sign in to comment.