Remove goog.string

This commit is contained in:
Neil Fraser
2018-06-10 21:28:29 -07:00
committed by Neil Fraser
parent 3909bd420a
commit 03bf9f5e71
7 changed files with 35 additions and 19 deletions

View File

@@ -525,7 +525,7 @@ Blockly.utils.tokenizeInterpolation_ = function(message,
// BKY_ is the prefix used to namespace the strings used in Blockly
// core files and the predefined blocks in ../blocks/. These strings
// are defined in ../msgs/ files.
var bklyKey = goog.string.startsWith(keyUpper, 'BKY_') ?
var bklyKey = Blockly.utils.startsWith(keyUpper, 'BKY_') ?
keyUpper.substring(4) : null;
if (bklyKey && bklyKey in Blockly.Msg) {
var rawValue = Blockly.Msg[bklyKey];
@@ -901,3 +901,14 @@ Blockly.utils.getViewportBBox = function() {
left: scrollOffset.x
};
};
/**
* Fast prefix-checker.
* Copied from Closure's goog.string.startsWith.
* @param {string} str The string to check.
* @param {string} prefix A string to look for at the start of `str`.
* @return {boolean} True if `str` begins with `prefix`.
*/
Blockly.utils.startsWith = function(str, prefix) {
return str.lastIndexOf(prefix, 0) == 0;
};