From 08a59591ae25280cf11e49d0f5eab4d5a438e147 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 25 Aug 2018 22:42:26 +0900 Subject: Use startsWith and endsWith for readability --- src/mfm/parse/core/syntax-highlighter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mfm/parse/core') diff --git a/src/mfm/parse/core/syntax-highlighter.ts b/src/mfm/parse/core/syntax-highlighter.ts index 3fb7a3b73d..2b13608d2b 100644 --- a/src/mfm/parse/core/syntax-highlighter.ts +++ b/src/mfm/parse/core/syntax-highlighter.ts @@ -197,7 +197,7 @@ const elements: Element[] = [ if (thisIsNotARegexp) return null; if (regexp == '') return null; - if (regexp[0] == ' ' && regexp[regexp.length - 1] == ' ') return null; + if (regexp.startsWith(' ') && regexp.endsWith(' ')) return null; return { html: `/${escape(regexp)}/`, -- cgit v1.2.3-freya