Open techwithtwin opened 2 weeks ago
I'm seeing this too (error logs below, for reference)
The issue seems to be caused by:
https://github.com/mikemaccana/whois-json/blob/82de25f73fc12703b78e974ac5ea92fae5172a81/index.js#L3
The fix would be to update it to:
- log = console.log.bind(console),
+ const log = (...args) => console.log(...args);
If this project is still maintained, I'd be happy to run some tests and submit a PR? :)
@techwithtwin, are you using a non-node runtime, like Deno? If so, that would explain why you're seeing this, as the method binding technique used here works only in Node.js, because console.log is a build-in function. But this approach will cause issues in any other runtime environment, since it won't be able to handle the bound reference properly.
I'm guessing the original purpose of this is to ensure that console.log is always called with the correct this
context (@mikemaccana?). However, in this context I don't think it's necessary, console.log
is usually pretty robust without needing to bind its context explicitly, and it just adds confusion to the code, as well as preventing it from working in other runtimes.
In case anyone was looking for a working version, I've re-written this package to resolve this issue, and to make it compatible with newer versions of JS as well as a variety of runtimes.
https://gist.github.com/Lissy93/e33a6b2218f57c51127bbbe7046f5c83
Hope that helps someone :)