ascii-table icon indicating copy to clipboard operation
ascii-table copied to clipboard

global 'this' may not always be available, leading to breakage

Open atsepkov opened this issue 7 years ago • 0 comments

In your last line, you pass 'this' context to a self-calling function. 'this' later gets used to append AsciiTable class to it. Normally, 'this' references the window object. Depending on how you load the script, however, 'this' could be undefined. One example is if you load the script via an eval. My solution was to change .call(this) to .call(window), I suggest a similar fix for the version in this repo, or something like .call(window || global) if it needs to work in node.

atsepkov avatar Mar 07 '17 09:03 atsepkov