Convert main trademapper.js to module pattern