char/avril
(wip) why'd you have to go and make things so complicaaaaated?
git clone https://git.t4t.associates/char/avril
44fe2c6
main
1import { 2ObjectDefineProperty as define , 3ObjectGetOwnPropertyDescriptor as descriptor , 4ReflectOwnKeys , 5SymbolToStringTag , 6} from "ext:core/primordials" ; 7 8export function installGlobal ( name :string , value :unknown ) :void { 9define ( globalThis , name , { value, writable :true , configurable :true }); 10} 11export function installInterface ( 12name :string , 13ctor :{ prototype :object }, 14) :void { 15const keys = ReflectOwnKeys ( ctor . prototype ); 16for ( let i = 0 ; i < keys . length ; i ++ ) { 17if ( keys [ i ] !== "constructor" ) { 18const d = descriptor ( ctor . prototype , keys [ i ]) ! ; 19d . enumerable = true ; 20define ( ctor . prototype , keys [ i ], d ); 21} 22} 23define ( ctor . prototype , SymbolToStringTag , { 24value :name , 25configurable :true , 26}); 27installGlobal ( name , ctor ); 28}