Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/UIString.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/common/UIString.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/UIString.js b/third_party/WebKit/Source/devtools/front_end/common/UIString.js
index d4da1c5c2a7913d4d7227cd24cf8104b908d96a8..07c8f5b693cec920cb32489dcf689bb978664aba 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/UIString.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/UIString.js
@@ -28,15 +28,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
/**
* @param {string} string
* @param {...*} vararg
* @return {string}
*/
-WebInspector.UIString = function(string, vararg)
-{
- return String.vsprintf(WebInspector.localize(string), Array.prototype.slice.call(arguments, 1));
+WebInspector.UIString = function(string, vararg) {
+ return String.vsprintf(WebInspector.localize(string), Array.prototype.slice.call(arguments, 1));
};
/**
@@ -44,67 +42,70 @@ WebInspector.UIString = function(string, vararg)
* @param {...*} vararg
* @return {string}
*/
-WebInspector.UIString.capitalize = function(string, vararg)
-{
- if (WebInspector._useLowerCaseMenuTitles === undefined)
- throw "WebInspector.setLocalizationPlatform() has not been called";
+WebInspector.UIString.capitalize = function(string, vararg) {
+ if (WebInspector._useLowerCaseMenuTitles === undefined)
+ throw 'WebInspector.setLocalizationPlatform() has not been called';
- var localized = WebInspector.localize(string);
- var capitalized;
- if (WebInspector._useLowerCaseMenuTitles)
- capitalized = localized.replace(/\^(.)/g, "$1");
- else
- capitalized = localized.replace(/\^(.)/g, function(str, char) { return char.toUpperCase(); });
- return String.vsprintf(capitalized, Array.prototype.slice.call(arguments, 1));
+ var localized = WebInspector.localize(string);
+ var capitalized;
+ if (WebInspector._useLowerCaseMenuTitles)
+ capitalized = localized.replace(/\^(.)/g, '$1');
+ else
+ capitalized = localized.replace(/\^(.)/g, function(str, char) {
+ return char.toUpperCase();
+ });
+ return String.vsprintf(capitalized, Array.prototype.slice.call(arguments, 1));
};
/**
* @param {string} platform
*/
-WebInspector.setLocalizationPlatform = function(platform)
-{
- WebInspector._useLowerCaseMenuTitles = platform === "windows";
+WebInspector.setLocalizationPlatform = function(platform) {
+ WebInspector._useLowerCaseMenuTitles = platform === 'windows';
};
/**
* @param {string} string
* @return {string}
*/
-WebInspector.localize = function(string)
-{
- return string;
+WebInspector.localize = function(string) {
+ return string;
};
/**
- * @constructor
- * @param {string} format
+ * @unrestricted
*/
-WebInspector.UIStringFormat = function(format)
-{
+WebInspector.UIStringFormat = class {
+ /**
+ * @param {string} format
+ */
+ constructor(format) {
/** @type {string} */
this._localizedFormat = WebInspector.localize(format);
/** @type {!Array.<!Object>} */
this._tokenizedFormat = String.tokenizeFormatString(this._localizedFormat, String.standardFormatters);
-};
+ }
-/**
- * @param {string} a
- * @param {string} b
- * @return {string}
- */
-WebInspector.UIStringFormat._append = function(a, b)
-{
+ /**
+ * @param {string} a
+ * @param {string} b
+ * @return {string}
+ */
+ static _append(a, b) {
return a + b;
-};
+ }
-WebInspector.UIStringFormat.prototype = {
- /**
- * @param {...*} vararg
- * @return {string}
- */
- format: function(vararg)
- {
- return String.format(this._localizedFormat, arguments,
- String.standardFormatters, "", WebInspector.UIStringFormat._append, this._tokenizedFormat).formattedResult;
- }
+ /**
+ * @param {...*} vararg
+ * @return {string}
+ */
+ format(vararg) {
+ return String
+ .format(
+ this._localizedFormat, arguments, String.standardFormatters, '', WebInspector.UIStringFormat._append,
+ this._tokenizedFormat)
+ .formattedResult;
+ }
};
+
+

Powered by Google App Engine
This is Rietveld 408576698