From 73169f06dff767020718a5715eba97d3575ba7e1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 24 Feb 2024 23:47:57 -0500 Subject: Turn on @typescript-eslint/no-unsafe-argument (#728) --- ext/js/media/audio-downloader.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ext/js/media') diff --git a/ext/js/media/audio-downloader.js b/ext/js/media/audio-downloader.js index d3bec75a..4cb3eb81 100644 --- a/ext/js/media/audio-downloader.js +++ b/ext/js/media/audio-downloader.js @@ -304,7 +304,17 @@ export class AudioDownloader { throw new Error('No custom URL defined'); } const data = {term, reading}; - return url.replace(/\{([^}]*)\}/g, (m0, m1) => (Object.prototype.hasOwnProperty.call(data, m1) ? `${data[/** @type {'term'|'reading'} */ (m1)]}` : m0)); + /** + * @param {string} m0 + * @param {string} m1 + * @returns {string} + */ + const replacer = (m0, m1) => ( + Object.prototype.hasOwnProperty.call(data, m1) ? + `${data[/** @type {'term'|'reading'} */ (m1)]}` : + m0 + ); + return url.replace(/\{([^}]*)\}/g, replacer); } /** -- cgit v1.2.3