From acbb06edf7df9757ae4423ffe31933647812b979 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Mar 2024 22:32:17 +0100 Subject: [PATCH] Split code --- packages/string-templates/src/index.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/string-templates/src/index.ts b/packages/string-templates/src/index.ts index d17bacb9a9..77ff1f8d73 100644 --- a/packages/string-templates/src/index.ts +++ b/packages/string-templates/src/index.ts @@ -168,16 +168,15 @@ export function processStringSync( function process(stringPart: string) { const template = createTemplate(stringPart, opts) const now = Math.floor(Date.now() / 1000) * 1000 - return postprocess( - template({ - now: new Date(now).toISOString(), - __opts: { - ...opts, - input: stringPart, - }, - ...context, - }) - ) + const processedString = template({ + now: new Date(now).toISOString(), + __opts: { + ...opts, + input: stringPart, + }, + ...context, + }) + return postprocess(processedString) } try { if (opts && opts.onlyFound) {