From 60d2cff723bf0e4e87404162c8915b4d8043085e Mon Sep 17 00:00:00 2001 From: hmhealey Date: Wed, 16 Sep 2015 14:01:05 -0400 Subject: Replaced instances of startsWith with lastIndexOf in TextFormatting --- web/react/utils/text_formatting.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index 2c67d7a46..2025e16da 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -56,7 +56,7 @@ function autolinkUrls(text, tokens) { const linkText = match.getMatchedText(); let url = linkText; - if (!url.startsWith('http')) { + if (!url.lastIndexOf('http', 0) === 0) { url = `http://${linkText}`; } @@ -160,7 +160,7 @@ function autolinkHashtags(text, tokens) { var newTokens = new Map(); for (const [alias, token] of tokens) { - if (token.originalText.startsWith('#')) { + if (token.originalText.lastIndexOf('#', 0) === 0) { const index = tokens.size + newTokens.size; const newAlias = `__MM_HASHTAG${index}__`; -- cgit v1.2.3-1-g7c22