import { MalError } from './types' ; import { convertJSObjectToMalMap } from './reader' ; export default { resolveJS ( str ) { if ( str . match ( /\./ ) ) { const match = /^(.*)\.[^\.]*$/ . exec ( str ) ; if ( match === null ) { throw new MalError ( '[interop.resolveJS] Cannot resolve' ) ; } else { return [ eval ( match [ 1 ] ) , eval ( str ) ] ; } } else { return [ globalThis , eval ( str ) ] ; } } , jsToMal ( obj ) { if ( obj === null || obj === undefined ) { return null ; } return convertJSObjectToMalMap ( obj ) ; } , } ;