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

Side by Side Diff: Source/devtools/front_end/common/utilities.js

Issue 340513003: DevTools: Add JSDoc for static methods, fix JSDoc types and induced errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased patch Created 6 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 /** 855 /**
856 * @param {string} format 856 * @param {string} format
857 * @param {...*} var_arg 857 * @param {...*} var_arg
858 * @return {string} 858 * @return {string}
859 */ 859 */
860 String.sprintf = function(format, var_arg) 860 String.sprintf = function(format, var_arg)
861 { 861 {
862 return String.vsprintf(format, Array.prototype.slice.call(arguments, 1)); 862 return String.vsprintf(format, Array.prototype.slice.call(arguments, 1));
863 } 863 }
864 864
865 /**
866 * @param {string} format
867 * @param {!Object.<string, function(string, ...):*>} formatters
868 * @return {!Array.<!Object>}
869 */
865 String.tokenizeFormatString = function(format, formatters) 870 String.tokenizeFormatString = function(format, formatters)
866 { 871 {
867 var tokens = []; 872 var tokens = [];
868 var substitutionIndex = 0; 873 var substitutionIndex = 0;
869 874
870 function addStringToken(str) 875 function addStringToken(str)
871 { 876 {
872 tokens.push({ type: "string", value: str }); 877 tokens.push({ type: "string", value: str });
873 } 878 }
874 879
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 /** 974 /**
970 * @param {string} format 975 * @param {string} format
971 * @param {!Array.<*>} substitutions 976 * @param {!Array.<*>} substitutions
972 * @return {string} 977 * @return {string}
973 */ 978 */
974 String.vsprintf = function(format, substitutions) 979 String.vsprintf = function(format, substitutions)
975 { 980 {
976 return String.format(format, substitutions, String.standardFormatters, "", f unction(a, b) { return a + b; }).formattedResult; 981 return String.format(format, substitutions, String.standardFormatters, "", f unction(a, b) { return a + b; }).formattedResult;
977 } 982 }
978 983
984 /**
985 * @param {string} format
986 * @param {?Array.<string>} substitutions
987 * @param {!Object.<string, function(string, ...):string>} formatters
988 * @param {!T} initialValue
989 * @param {function(T, string): T|undefined} append
990 * @return {!{formattedResult: T, unusedSubstitutions: ?Array.<string>}};
991 * @template T
992 */
979 String.format = function(format, substitutions, formatters, initialValue, append ) 993 String.format = function(format, substitutions, formatters, initialValue, append )
980 { 994 {
981 if (!format || !substitutions || !substitutions.length) 995 if (!format || !substitutions || !substitutions.length)
982 return { formattedResult: append(initialValue, format), unusedSubstituti ons: substitutions }; 996 return { formattedResult: append(initialValue, format), unusedSubstituti ons: substitutions };
983 997
984 function prettyFunctionName() 998 function prettyFunctionName()
985 { 999 {
986 return "String.format(\"" + format + "\", \"" + substitutions.join("\", \"") + "\")"; 1000 return "String.format(\"" + format + "\", \"" + substitutions.join("\", \"") + "\")";
987 } 1001 }
988 1002
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 this._outgoingCallback(); 1745 this._outgoingCallback();
1732 } 1746 }
1733 } 1747 }
1734 1748
1735 /** 1749 /**
1736 * @param {*} value 1750 * @param {*} value
1737 */ 1751 */
1738 function suppressUnused(value) 1752 function suppressUnused(value)
1739 { 1753 {
1740 } 1754 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/common/TextRange.js ('k') | Source/devtools/front_end/components/FilterBar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698