Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Const.prototype.toString returns the plain value instead of adding …
Browse files Browse the repository at this point in the history
…`Const{}` around.

RELNOTES: Const toString returns the plain value.

PiperOrigin-RevId: 576168661
Change-Id: I8a65845e5d01a4ff72506bef565bad1b0ee0665d
  • Loading branch information
Closure Team authored and copybara-github committed Oct 24, 2023
1 parent 81b495a commit 530dcfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions closure/goog/string/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ if (goog.DEBUG) {
*/
goog.string.Const.prototype.toString = function() {
'use strict';
return 'Const{' +
this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ +
'}';
return this
.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
};
}

Expand Down
2 changes: 1 addition & 1 deletion closure/goog/string/const_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ testSuite({
const extracted = Const.unwrap(constString);
assertEquals('blah', extracted);
assertEquals('blah', constString.getTypedStringValue());
assertEquals('Const{blah}', String(constString));
assertEquals('blah', String(constString));

// Interface marker is present.
assertTrue(constString.implementsGoogStringTypedString);
Expand Down

0 comments on commit 530dcfa

Please sign in to comment.