Closed agudulin closed 8 years ago
I've created corresponding PR for that: https://github.com/Adyen/CSE-JS/pull/17
if (module && module.exports) {
this code leads to the exception in a browser because 'module' is undefined
@vkurlyan no, it does not :)
the second condition will never be executed if the first one is falsy.
so if (undefined && undefined.exports) { ... }
will never show the execption
however the corresponding PR has been already merged and this issue can be closed
If module is undefined we will have excaption because it's undefined variable but not property. You need to change code to do it without excaption:
if (typeof module !== 'undefined' && module.exports)
I added pull request https://github.com/Adyen/CSE-JS/pull/25
@vkurlyan ah, I see, thanks!
When I try to use no-dom version as a node module, I get the wrong object.
Why
Every node module has a
module
variable as a reference to the object representing the current module.And I figured out that this variable is used in
sjcl
library, and you include this library into your module without any encapsulation.As a result, when I import your library I get
sjcl
library instead.How to fix
You may want to wrap this code into closure, and pass an empty object as
module
variable:Also after defining AMD module it would be great to make it obvious what exactly do we want to export: