From e2f65c0c3cc786865d7e6c4c6118221ee4ca277b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 21 Mar 2024 15:49:25 +0100 Subject: things: use replaceAll when trimming authors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were using just `#replace`, which gives us some bad results which were easily fixed via `#replaceAll`. Signed-off-by: Miquel Sabaté Solà --- app/javascript/controllers/thing_controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/javascript/controllers/thing_controller.js b/app/javascript/controllers/thing_controller.js index ca957ba..615e466 100644 --- a/app/javascript/controllers/thing_controller.js +++ b/app/javascript/controllers/thing_controller.js @@ -46,7 +46,7 @@ export default class extends Controller { if (idx > -1) { let idx2 = author.indexOf('_', idx + 1); if (idx2 > -1) { - return author.substring(idx + 1, idx2).replace(' ', ''); + return author.substring(idx + 1, idx2).replaceAll(' ', ''); } } @@ -54,7 +54,7 @@ export default class extends Controller { // name. return author .split(' ').pop().trim() // Pick the last element. - .replace('-', ''); // "Last-Other" => "LastOther" + .replaceAll('-', ''); // "Last-Other" => "LastOther" } // Update the information we get from the year field so to autocomplete it -- cgit v1.2.3