eslint: Fix unicorn/prefer-regexp-test.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-01-22 17:50:13 -08:00
committed by Tim Abbott
parent a77120279d
commit a679ee12f3
2 changed files with 2 additions and 2 deletions

View File

@@ -318,7 +318,7 @@ exports.paste_handler = function (event) {
if (paste_html && page_params.development_environment) { if (paste_html && page_params.development_environment) {
const text = exports.paste_handler_converter(paste_html); const text = exports.paste_handler_converter(paste_html);
const mdImageRegex = /^!\[.*]\(.*\)$/; const mdImageRegex = /^!\[.*]\(.*\)$/;
if (text.match(mdImageRegex)) { if (mdImageRegex.test(text)) {
// This block catches cases where we are pasting an // This block catches cases where we are pasting an
// image into Zulip, which is handled by upload.js. // image into Zulip, which is handled by upload.js.
return; return;

View File

@@ -37,7 +37,7 @@ exports.highlight_with_escaping_and_regex = function (regex, item) {
let result = ""; let result = "";
for (const piece of pieces) { for (const piece of pieces) {
if (piece.match(regex)) { if (regex.test(piece)) {
result += "<strong>" + Handlebars.Utils.escapeExpression(piece) + "</strong>"; result += "<strong>" + Handlebars.Utils.escapeExpression(piece) + "</strong>";
} else { } else {
result += Handlebars.Utils.escapeExpression(piece); result += Handlebars.Utils.escapeExpression(piece);