Open obregon08 opened 8 years ago
You shouldn't need Babel - recent versions of the V8 engine support const and let natively. You should upgrade your NodeJS environment. Thanks for pointing that out though - maybe i'll add a note to that extent in the README.md.
Out of curiosity, which version are you using now and how are you calling the library exactly?
(If I'd had written this in ES6 I would also have used classes and lambda functions ;)).
For compatibility reasons with the rest of the ecosystem in which other developers at work run their dev boxes, I'm pretty much forced to these versions:
$ node -v
v0.12.14
$ npm -v
2.15.1
$ php -v
PHP 5.5.37 (cli) (built: Jul 6 2016 12:02:06)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
That's... pretty ancient. But having said that, just replacing const/let with var doesn't hurt it in any way either, so if you create a pull request I'll be happy to merge it in.
I ran into this issue because I didn't have Babel setup. Sooo... I decided to just replace ES6 specific stuff with ES5. Below the updated
lib/php2js.js
file.