Index: Source/devtools/front_end/common/TextUtils.js |
diff --git a/Source/devtools/front_end/common/TextUtils.js b/Source/devtools/front_end/common/TextUtils.js |
index 2310478a50c4635b92e7d5122205c2b76a7f31ac..73cd6f92f1158c771fffd2967f2235c4ce538f7c 100644 |
--- a/Source/devtools/front_end/common/TextUtils.js |
+++ b/Source/devtools/front_end/common/TextUtils.js |
@@ -148,6 +148,33 @@ WebInspector.TextUtils = { |
isLowerCase: function(text) |
{ |
return text === text.toLowerCase(); |
+ }, |
+ |
+ /** |
+ * @param {string} text |
+ * @return {string} |
+ */ |
+ extension: function(text) |
+ { |
+ var lastIndexOfDot = text.lastIndexOf("."); |
+ var extension = lastIndexOfDot !== -1 ? text.substr(lastIndexOfDot + 1) : ""; |
+ var indexOfQuestionMark = extension.indexOf("?"); |
+ if (indexOfQuestionMark !== -1) |
+ extension = extension.substr(0, indexOfQuestionMark); |
+ return extension; |
+ }, |
+ |
+ /** |
+ * @param {string} text |
+ * @return {string} |
+ */ |
+ fileName: function(text) { |
pfeldman
2015/08/13 21:15:46
{ goes the next line. Aslo seem like these two hav
wes
2015/08/14 00:55:04
Probably. They're both just helpers for extracting
|
+ var lastIndexOfSep = text.lastIndexOf("/"); |
+ var extension = lastIndexOfSep !== -1 ? text.substr(lastIndexOfSep + 1) : text; |
+ var indexOfQuestionMark = extension.indexOf("?"); |
+ if (indexOfQuestionMark !== -1) |
+ extension = extension.substr(0, indexOfQuestionMark); |
+ return extension; |
} |
} |