From c5b72fdec9b9c6a9109ff09962572ed4c76ed2b1 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 4 Jan 2025 16:31:59 +0200 Subject: [PATCH] Tidy up code addendum --- content/snippets/js/s/complex-object-factories.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/snippets/js/s/complex-object-factories.md b/content/snippets/js/s/complex-object-factories.md index 1ddde74e95c..e2d9645f71a 100644 --- a/content/snippets/js/s/complex-object-factories.md +++ b/content/snippets/js/s/complex-object-factories.md @@ -739,8 +739,10 @@ export default class Factory { const data = { ...factoryBase }; desiredTraits.forEach(trait => { - if (typeof trait === 'string') Object.assign(data, traits[trait]); - else if (typeof trait === 'object') Object.assign(data, trait); + if (typeof trait === 'string') + Object.assign(data, traits[trait]); + else if (typeof trait === 'object') + Object.assign(data, trait); else if (typeof trait === 'function') Object.assign(data, trait(data)); });