summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-09-16 11:17:25 -0700
committerCorey Hulen <corey@hulen.com>2015-09-16 11:17:25 -0700
commit4e11fa23d750afbefad099638530b754776a3357 (patch)
tree8c3552c4fe60597d5a10e2b90c42f8987e85163d
parent7e418714bce067172e527359f391943459b3bd48 (diff)
parent60d2cff723bf0e4e87404162c8915b4d8043085e (diff)
downloadchat-4e11fa23d750afbefad099638530b754776a3357.tar.gz
chat-4e11fa23d750afbefad099638530b754776a3357.tar.bz2
chat-4e11fa23d750afbefad099638530b754776a3357.zip
Merge pull request #695 from hmhealey/startswith
Replaced instances of startsWith with lastIndexOf in TextFormatting
-rw-r--r--web/react/utils/text_formatting.jsx4
1 files changed, 2 insertions, 2 deletions
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}__`;