aboutsummaryrefslogtreecommitdiff
path: root/ext/js/media
diff options
context:
space:
mode:
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);
}
/**