JS-Interpreter
JS-Interpreter copied to clipboard
new Date(number) throws TypeError: Bind must be called on a function
Hello,
When calling new Date(1234) I get this error:
TypeError: Bind must be called on a function
I would expect just to get a Date with valueOf returning 1234.
Can't recreate. My steps:
- Go to https://neil.fraser.name/software/JS-Interpreter/
- Replace code with:
alert(new Date(1234)) - Press Parse then press Run.
Actual result: An alert with "Wed Dec 31 1969 16:00:01 GMT-0800 (Pacific Standard Time)"
What steps are you using to get this error?
Just install js-interpreter npm module with npm install js-interpreter, then run node command in a terminal and then this JS code: (new (require('js-interpreter'))("new Date(1234)")).run();.
You should get the error TypeError: Bind must be called on a function.
Got it. This bug was previously raised and fixed in #218. Looks like the js-interpreter package you are using needs to be updated. Not sure whom to ping regarding that.
The npm package seems abandoned :( https://www.npmjs.com/package/js-interpreter
It is downloaded 3100 times a week. You don't want to publish your project on npm?
@jer-sen @NeilFraser I have updated the package, sorry if this has been misleading, but the NPM package points to my repo which has this one as a submodule and publishes the package from there, I'll keep an eye on issues here in case the package related requests come up here.