Skip to content

Commit

Permalink
depth check removed
Browse files Browse the repository at this point in the history
yes, the depth of the object was being counted and there was a place where the if the depth was > 128 it'd throw an error
I can't cry about another package having undocumented features that can be annoying or even exploited when I'm doing the same
The options were to either update the README or remove the feature (I chose to remove the feature)
Because the feature makes it a hassle for anyone who wants to share even a slightly mutable object worrying about preventing the max depth from being reached
That said, if you are sharing a slightly mutable object, it is recommended to be VERY specific about what client edits are allowed
The next updates should just be documentation updates to show proper code snippets and examples (tests.js is probably confusing right now)
  • Loading branch information
Y0ursTruly committed Jul 25, 2024
1 parent 2c98f09 commit 354537d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
map.delete(orig)
map.delete(cloned)
}
function recurse(obj,clone,map,list,PATH,level,RECURSED,isTop){
if(level>128) throw new RangeError("Given object goes too many levels inward (>128)");
function recurse(obj,clone,map,list,PATH,RECURSED,isTop){
let KEYS=keys(obj), KEYS1=keys(clone), data=map.get(obj)
if(isTop) RECURSED.set(obj,true);
if(obj instanceof Array){
Expand Down Expand Up @@ -178,7 +177,7 @@
}
if(!RECURSED.get(item)){
RECURSED.set(item,true);
recurse(obj[key],clone[key],map,list,Path,level+1,RECURSED);
recurse(obj[key],clone[key],map,list,Path,RECURSED);
}
}
}
Expand Down Expand Up @@ -207,7 +206,7 @@
//mentioned is if part of path was already referenced in outgoing string
//0 means no(do nothing), 1 means path is mentioned in part[0], 2 means the same for part[1]
map.set(obj,[path,0,1,clone,1]) //see temp description in recurse function above
recurse(obj,clone,map,list,path,1,new WeakMap(),true)
recurse(obj,clone,map,list,path,new WeakMap(),true)
return str(list)
}

Expand Down

0 comments on commit 354537d

Please sign in to comment.