export const dummyTargetObject = { } ; export const { g : globalObj , o : objConstructor , f : funConstructor } = ( ( ) => { let globalObj = null ; try { globalObj = Function ( 'return this' ) ( ) ; } catch ( e ) { } if ( ! globalObj ) { if ( typeof window === 'object' && window ) { globalObj = window ; } else if ( typeof global === 'object' && global ) { globalObj = global ; } else if ( typeof globalThis === 'object' && globalThis ) { globalObj = globalThis ; } else { globalObj = dummyTargetObject ; } } let objConstructor = null as any ; try { objConstructor = ( ( { } ) . constructor ?? Object ) as any ; } catch ( e ) { } if ( ! objConstructor ) { objConstructor = dummyTargetObject as any ; } let funConstructor = null as any ; try { funConstructor = ( ( { } ) . toString . constructor ?? Function ) as any ; } catch ( e ) { } if ( ! funConstructor ) { funConstructor = dummyTargetObject as any ; } return ( { g : globalObj , o : objConstructor , f : funConstructor } ) ; } ) ( ) ; export function isUnsafeVarNames ( target , varName ) { if ( target === globalObj || varName === '__proto__' || varName === '__defineGetter__' || varName === '__defineSetter__' || varName === '__lookupGetter__' || varName === '__lookupSetter__' ) { return true ; } if ( varName === 'prototype' || varName === 'constructor' ) { if ( target === null || target === void 0 || typeof target === 'function' ) { return true ; } } if ( target === null || target === void 0 || target === objConstructor ) { if ( Object . prototype . hasOwnProperty . call ( objConstructor , varName ) ) { return true ; } } if ( target === null || target === void 0 || target === funConstructor ) { let con = funConstructor ; while ( con ) { if ( Object . prototype . hasOwnProperty . call ( con , varName ) ) { return true ; } con = con . __proto__ ; } } if ( typeof target === 'function' ) { if ( ! Object . prototype . hasOwnProperty . call ( target , varName ) ) { return true ; } } return false ; }