char/avril
(wip) why'd you have to go and make things so complicaaaaated?
git clone https://git.t4t.associates/char/avril
f4a0f5b
main
1(() => { 2const result = []; 3const seen = new Set (); 4function walk ( path , object , depth ) { 5if ( 6object === null || 7( typeof object !== "object" && typeof object !== "function" ) || 8seen . has ( object ) || depth > 3 9) return ; 10seen . add ( object ); 11const prototype = Object . getPrototypeOf ( object ); 12result . push ( JSON . stringify ([ 13path , 14Object . isExtensible ( object ), 15Object . isFrozen ( object ), 16prototype === null ?null :prototype . constructor ?. name , 17])); 18const keys = Reflect . ownKeys ( object ). map (( key ) => [ key , String ( key )]); 19keys . sort (( a , b ) => a [ 1 ] < b [ 1 ] ?- 1 :a [ 1 ] > b [ 1 ] ?1 :0 ); 20for ( const [ key , name ] of keys ) { 21const descriptor = Object . getOwnPropertyDescriptor ( object , key ); 22const child = ` ${ path } . ${ name } ` ; 23result . push ( JSON . stringify ([ 24child , 25descriptor . enumerable , 26descriptor . configurable , 27"value" in descriptor 28 ?[ 29descriptor . value === null ?"null" :typeof descriptor . value , 30descriptor . writable , 31] 32 :[ typeof descriptor . get , typeof descriptor . set ], 33])); 34if ( "value" in descriptor ) walk ( child , descriptor . value , depth + 1 ); 35} 36} 37walk ( "globalThis" , globalThis , 0 ); 38result . push ( `globalEventTarget: ${ globalThis instanceof EventTarget } ` ); 39let dispatched = false ; 40const listener = () => dispatched = true ; 41addEventListener ( "snapshot-surface" , listener , { once :true }); 42dispatchEvent ( new Event ( "snapshot-surface" )); 43result . push ( `globalDispatch: ${ dispatched } ` ); 44return result ; 45})();