Closed therufa closed 7 years ago
Thanks - looks reasonable, I'll try and get to testing it in the next few days.
Only initial feedback is that it could use a comment in the code explaining why this is necessary (e.g. even something as simple as saying that it could be evaluated in strict contexts where this
is undefined.)
The factory(global)
line is missing a semicolon. (I try not to rely on ASI.)
We could also restructure it as IIFE at the end of the file that in place of the original }(this));
but it's probably better to have this at the top of the file to make the execution order more obvious.
The changes inside this library have been made in order to solve a transpiling issue with Babel.
We are using this lib in combination of Babel and Webpack, and we had an issue during the transpiling process. Babel sadly does not understand the meaning of
this
, so it was replaced with the next best it could find, which wasundefined
. In order to maintain compatibility with browser as well as other environments, we decided to wrap the entire scope inside a simple factory.