From 354537dc86edd1937ec2671b4536b56abf9c2f48 Mon Sep 17 00:00:00 2001 From: Paul Taylor <60293767+Y0ursTruly@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:15:47 +0000 Subject: [PATCH] depth check removed 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) --- serial.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/serial.js b/serial.js index cfee532..b6fe1b2 100644 --- a/serial.js +++ b/serial.js @@ -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){ @@ -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); } } } @@ -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) }