mathiasbynens / jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
https://mths.be/jsesc
MIT License
716 stars 53 forks source link

missing = in const declaration #33

Closed Akkuma closed 7 years ago

Akkuma commented 8 years ago

https://github.com/mathiasbynens/jsesc/blob/30be7a62d862d8b5b49ffc4424a10c85f0ee6f6d/src/jsesc.js#L6 causes Firefox to throw the above error, which can be reproduced by pasting this into Firefox's console.

for (const key in {t:1,x:1}) {
  if (hasOwnProperty.call(object, key)) {
    console.log('Never reaches as the code errors');
  }
}

This makes jsesc unusable with webpack/browserify in those environments without explicitly converting the es6 code into es5.

mathiasbynens commented 7 years ago

https://github.com/mathiasbynens/jsesc#support