Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Fix unicorn/prefer-regexp-test.

Anders Kaseorga679ee12f39f
diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js
index 649ee2d1d38..2c3e55f616d 100644
--- a/static/js/copy_and_paste.js
+++ b/static/js/copy_and_paste.js
@@ -318,7 +318,7 @@ exports.paste_handler = function (event) {
if (paste_html && page_params.development_environment) {
const text = exports.paste_handler_converter(paste_html);
const mdImageRegex = /^!\[.*]\(.*\)$/;
- if (text.match(mdImageRegex)) {
+ if (mdImageRegex.test(text)) {
// This block catches cases where we are pasting an
// image into Zulip, which is handled by upload.js.
return;
diff --git a/static/js/typeahead_helper.js b/static/js/typeahead_helper.js
index d51e4f1e7c2..05691571879 100644
--- a/static/js/typeahead_helper.js
+++ b/static/js/typeahead_helper.js
@@ -37,7 +37,7 @@ exports.highlight_with_escaping_and_regex = function (regex, item) {
let result = "";
for (const piece of pieces) {
- if (piece.match(regex)) {
+ if (regex.test(piece)) {
result += "<strong>" + Handlebars.Utils.escapeExpression(piece) + "</strong>";
} else {
result += Handlebars.Utils.escapeExpression(piece);