Closed 2pha closed 6 years ago
Thanks for the suggestion @2pha, I've just published version 0.1.6
having this!
It's now possible to extend global functions on the global.js
file: https://github.com/endel/js2php/blob/ebe309f3c5f085e1100c6790a95d4763040ada69/core/global.js#L5-L15
Awesome, thanks mate
A bit of a problem with this.
Add this to the "global_functions.js" fixture has an error.
let temp = "50"; var_dump(parseInt(temp));
Error is: "'Cannot read property 'scope' of undefined' TypeError: Cannot read property 'scope' of undefined". in "at Object.get (/js2php/scope.js:66:14)"
The global javascript functions parseInt and parseFloat map pretty well to the PHP intval and floatval functions, it would be nice to support them. (and I need them on a project I am on).
I had a quick look in to it and it seems it won't be as easy as mapping functions that are on objects as these functions are in the global scope.