From b391704f3db77f19aad7e1a4e61b515a18475024 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 25 Feb 2020 21:58:12 -0500 Subject: Use for of --- ext/bg/js/audio.js | 4 ++-- ext/bg/js/backend.js | 4 ++-- ext/mixed/js/display.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index d300570b..972e2b8b 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -156,8 +156,8 @@ function audioBuildFilename(definition) { async function audioInject(definition, fields, sources, optionsContext) { let usesAudio = false; - for (const name in fields) { - if (fields[name].includes('{audio}')) { + for (const fieldValue of Object.values(fields)) { + if (fieldValue.includes('{audio}')) { usesAudio = true; break; } diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 717ffac3..6736b1ae 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -719,8 +719,8 @@ class Backend { async _injectScreenshot(definition, fields, screenshot) { let usesScreenshot = false; - for (const name in fields) { - if (fields[name].includes('{screenshot}')) { + for (const fieldValue of Object.values(fields)) { + if (fieldValue.includes('{screenshot}')) { usesScreenshot = true; break; } diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 12829650..b0bcff7c 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -705,8 +705,8 @@ class Display { noteUsesScreenshot() { const fields = this.options.anki.terms.fields; - for (const name in fields) { - if (fields[name].includes('{screenshot}')) { + for (const fieldValue of Object.values(fields)) { + if (fieldValue.includes('{screenshot}')) { return true; } } -- cgit v1.2.3