Replaced instances of startsWith with lastIndexOf in TextFormatting

Этот коммит содержится в:
hmhealey
2015-09-16 14:01:05 -04:00
родитель d4887cef03
Коммит 60d2cff723

Просмотреть файл

@@ -56,7 +56,7 @@ function autolinkUrls(text, tokens) {
const linkText = match.getMatchedText(); const linkText = match.getMatchedText();
let url = linkText; let url = linkText;
if (!url.startsWith('http')) { if (!url.lastIndexOf('http', 0) === 0) {
url = `http://${linkText}`; url = `http://${linkText}`;
} }
@@ -160,7 +160,7 @@ function autolinkHashtags(text, tokens) {
var newTokens = new Map(); var newTokens = new Map();
for (const [alias, token] of tokens) { for (const [alias, token] of tokens) {
if (token.originalText.startsWith('#')) { if (token.originalText.lastIndexOf('#', 0) === 0) {
const index = tokens.size + newTokens.size; const index = tokens.size + newTokens.size;
const newAlias = `__MM_HASHTAG${index}__`; const newAlias = `__MM_HASHTAG${index}__`;