Convert closure to es6 module
I'm using a javascript build environment that supports es6 modules ( using es6-module-transpiler ) so you can simply import stuff across different files. Now I got a third party library that I'd like to be "importable". The library populates its functionality like this: (function () {/*...*/}).call(this); Would it be safe to omit the closure and convert it to: export default function () {/* ... */}; Or is there a better way? Thanks in advance! The original code you show invokes the anonymous function, which to make any sense must define a global variable, whereas the second code fragment you