Closed exe-dealer closed 5 years ago
Thanks! I'd like to have the commits squashed into one and with a commit message that's a somewhat complete phrase and starts with an upper-case letter. I also need to set up travis integration again after moving the repo to the new bublejs organization. You're code changes are good to merge from my point of view, though :)
what about to replace String(expr)
to ""+expr
? Last code is uglier but its protected from String redeclaration
I think I would prefer String
, since it is prettier and performs the correct operation (toString
, not valueOf
).
class X {
valueOf() { return "valueOf" }
toString() { return "toString" }
}
console.log(
{ [new X()]: "new X()" },
(new X()) + "",
String(new X()),
{ valueOf: "valueOf", toString: "toString" }[new X()]
)
Ok, I merged this. Thanks for your patience!
That looks very good. Are you interested in adding some tests? Otherwise I'd merge this as it is and add tests myself.