const EMPTY = { } ; export function has ( obj , key ) { if ( obj == null ) { return false ; } if ( EMPTY [ key ] !== undefined ) { return Object . prototype . hasOwnProperty . call ( obj , key ) ; } return obj [ key ] !== undefined || key in obj ; } export function arrToDict < T extends string | number | symbol > ( values ) { const res = Object . create ( null ) ; for ( let i = 0 ; i < values . length ; i ++ ) { const value = values [ i ] ; res [ value ] = true ; } return res ; } const isSimplePropRegex = /^[a-zA-Z_][_a-zA-Z0-9]*$/ ; export function getAccessor ( prop ) { if ( typeof prop === "number" ) { return `[${ prop }]` ; } if ( ! isSimplePropRegex . test ( prop ) ) { return `[${ JSON . stringify ( prop ) }]` ; } return `.${ prop }` ; } export function getAccessorWithAlloc ( prop , alloc ) { if ( typeof prop === "number" ) { if ( Number . isSafeInteger ( prop ) ) { return `[${ prop }]` ; } const propVar = alloc ( "c" , prop ) ; return `[${ propVar }]` ; } if ( ! isSimplePropRegex . test ( prop ) ) { return `[${ JSON . stringify ( prop ) }]` ; } return `.${ prop }` ; }