summaryrefslogtreecommitdiff
path: root/ext/js/media
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-24 23:47:57 -0500
committerGitHub <noreply@github.com>2024-02-25 04:47:57 +0000
commit73169f06dff767020718a5715eba97d3575ba7e1 (patch)
tree99d458f9d2ca74e67dbb4bccd148ef549f7ce2cf /ext/js/media
parenta21948daf6210f67955ae4f98a81e21b8cf9f1f2 (diff)
Turn on @typescript-eslint/no-unsafe-argument (#728)24.2.26.0
Diffstat (limited to 'ext/js/media')
-rw-r--r--ext/js/media/audio-downloader.js12
1 files changed, 11 insertions, 1 deletions
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);
}
/**