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

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

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modify override dropdown to apply to console completions & transpile Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return text === text.toUpperCase(); 141 return text === text.toUpperCase();
142 }, 142 },
143 143
144 /** 144 /**
145 * @param {string} text 145 * @param {string} text
146 * @return {boolean} 146 * @return {boolean}
147 */ 147 */
148 isLowerCase: function(text) 148 isLowerCase: function(text)
149 { 149 {
150 return text === text.toLowerCase(); 150 return text === text.toLowerCase();
151 },
152
153 /**
154 * @param {string} text
155 * @return {string}
156 */
157 extension: function(text)
158 {
159 var lastIndexOfDot = text.lastIndexOf(".");
160 var extension = lastIndexOfDot !== -1 ? text.substr(lastIndexOfDot + 1) : "";
161 var indexOfQuestionMark = extension.indexOf("?");
162 if (indexOfQuestionMark !== -1)
163 extension = extension.substr(0, indexOfQuestionMark);
164 return extension;
165 },
166
167 /**
168 * @param {string} text
169 * @return {string}
170 */
171 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
172 var lastIndexOfSep = text.lastIndexOf("/");
173 var extension = lastIndexOfSep !== -1 ? text.substr(lastIndexOfSep + 1) : text;
174 var indexOfQuestionMark = extension.indexOf("?");
175 if (indexOfQuestionMark !== -1)
176 extension = extension.substr(0, indexOfQuestionMark);
177 return extension;
151 } 178 }
152 } 179 }
153 180
154 WebInspector.TextUtils._SpaceCharRegex = /\s/; 181 WebInspector.TextUtils._SpaceCharRegex = /\s/;
155 182
156 /** 183 /**
157 * @enum {string} 184 * @enum {string}
158 */ 185 */
159 WebInspector.TextUtils.Indent = { 186 WebInspector.TextUtils.Indent = {
160 TwoSpaces: " ", 187 TwoSpaces: " ",
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 */ 259 */
233 WebInspector.TokenizerFactory = function() { } 260 WebInspector.TokenizerFactory = function() { }
234 261
235 WebInspector.TokenizerFactory.prototype = { 262 WebInspector.TokenizerFactory.prototype = {
236 /** 263 /**
237 * @param {string} mimeType 264 * @param {string} mimeType
238 * @return {function(string, function(string, ?string, number, number))} 265 * @return {function(string, function(string, ?string, number, number))}
239 */ 266 */
240 createTokenizer: function(mimeType) { } 267 createTokenizer: function(mimeType) { }
241 } 268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698