paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 389 forks source link

"colors.js" adds non-function String#bold; breaks v0.25.1. #315

Closed rwaldron closed 9 years ago

rwaldron commented 9 years ago

https://github.com/paulmillr/es6-shim/commit/a0e0544eefd6b42b5e514584a4413033ed1c3219#commitcomment-9801840

ljharb commented 9 years ago

Thanks for the report! This definitely isn't meant to break. Can you provide some more info about what's breaking and what environment it's breaking on?

ljharb commented 9 years ago

My confusion here is that every key in https://github.com/paulmillr/es6-shim/commit/a0e0544eefd6b42b5e514584a4413033ed1c3219#diff-fbdfeb59ea7599799df83561186da7dfR2522 is installed on String.prototype in https://github.com/paulmillr/es6-shim/commit/a0e0544eefd6b42b5e514584a4413033ed1c3219#diff-fbdfeb59ea7599799df83561186da7dfR2521 - I wonder if arduinos have an Object.keys bug?

ljharb commented 9 years ago

OK, I think I figured it out. The npm module chalk unfortunately modifies String.prototype - which is not only a bad idea (for things that aren't shims), but also, it means that es6-shim is being required in after chalk is required, and usually the shim should be run first.

That said, I can certainly work around this.

ljharb commented 9 years ago

Fix will be published shortly - that said, I'd avoid using "colors.js" if at all possible in the future.

olizilla commented 9 years ago

for future archeologists, it's colors.js that's all up in the String.prototype, causing trouble, not chalk.

ljharb commented 9 years ago

@olizilla thanks, i've updated all my comments and the issue description