From 77769983d59882fd44f3c14bbca33ada966957db Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Thu, 19 Sep 2019 15:03:46 +0200 Subject: [PATCH] refactor --- src/compilers/po.compiler.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/compilers/po.compiler.ts b/src/compilers/po.compiler.ts index 3cb5358..a807fc1 100644 --- a/src/compilers/po.compiler.ts +++ b/src/compilers/po.compiler.ts @@ -24,11 +24,13 @@ export class PoCompiler implements CompilerInterface { translations: { [this.domain]: Object.keys(collection.values).reduce( (translations, key) => { - translations[key] = { - msgid: key, - msgstr: collection.get(key) + return { + ...translations, + [key]: { + msgid: key, + msgstr: collection.get(key) + } }; - return translations; }, {} as any ) @@ -50,8 +52,10 @@ export class PoCompiler implements CompilerInterface { .filter(key => key.length > 0) .reduce( (result, key) => { - result[key] = po.translations[this.domain][key].msgstr.pop(); - return result; + return { + ...result, + [key]: po.translations[this.domain][key].msgstr.pop() + }; }, {} as TranslationType );