From 72f99130130572fca5b234a8c28dd4e58e388297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 2 Nov 2022 13:28:19 +0100 Subject: [PATCH 1/2] :bug: Prevent double quotes on luxon datetimes --- packages/nodes-base/nodes/Code/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Code/utils.ts b/packages/nodes-base/nodes/Code/utils.ts index 7d92c9eddbfc3..15918d69aaabd 100644 --- a/packages/nodes-base/nodes/Code/utils.ts +++ b/packages/nodes-base/nodes/Code/utils.ts @@ -5,7 +5,7 @@ import type { IDataObject } from 'n8n-workflow'; */ export function standardizeOutput(output: IDataObject) { for (const [key, value] of Object.entries(output)) { - if (!isTraversable(value)) continue; + if (!isTraversable(value) || value.isLuxonDateTime) continue; output[key] = value.constructor.name !== 'Object' From 5d3a9954bc41490053b356d69d76264787928962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 2 Nov 2022 13:32:27 +0100 Subject: [PATCH 2/2] :zap: Generalize solution --- packages/nodes-base/nodes/Code/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Code/utils.ts b/packages/nodes-base/nodes/Code/utils.ts index 15918d69aaabd..0b389af9c145d 100644 --- a/packages/nodes-base/nodes/Code/utils.ts +++ b/packages/nodes-base/nodes/Code/utils.ts @@ -5,7 +5,7 @@ import type { IDataObject } from 'n8n-workflow'; */ export function standardizeOutput(output: IDataObject) { for (const [key, value] of Object.entries(output)) { - if (!isTraversable(value) || value.isLuxonDateTime) continue; + if (!isTraversable(value)) continue; output[key] = value.constructor.name !== 'Object' @@ -21,7 +21,7 @@ export function isObject(maybe: unknown): maybe is { [key: string]: unknown } { } function isTraversable(maybe: unknown): maybe is IDataObject { - return isObject(maybe) && Object.keys(maybe).length > 0; + return isObject(maybe) && typeof maybe.toJSON !== 'function' && Object.keys(maybe).length > 0; } export type CodeNodeMode = 'runOnceForAllItems' | 'runOnceForEachItem';