bestiejs / json3

A JSON polyfill. No longer maintained.
https://bestiejs.github.io/json3
Other
1.02k stars 150 forks source link

The minified script always has parseSupported = false because of a key that gets wrongly changed by the minifier. #24

Closed VittGam closed 11 years ago

VittGam commented 11 years ago

https://github.com/bestiejs/json3/blob/gh-pages/lib/json3.js#L130:

if ((parseSupported = value.A.length == 5 && value.A[0] == 1)) {

Minified code:

if(a=d.a.length==5&&d.a[0]==1){

The A key gets transformed into lowercase a in the minified script, thus parseSupported is always set to false.

At the moment I don't have time to dig further, but at a first glance this seems to be a problem with the Closure Compiler ADVANCED_OPTIMIZATIONS option.

ghost commented 11 years ago

You were correct; it was, indeed, being munged aggressively. Fixed in the v3.2.5 branch; will go out with the next release. Thanks!