mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(Code Node): Constently handle various kinds of data returned by user code (#6002)
This commit is contained in:
committed by
GitHub
parent
fe058aa8ee
commit
f9b3aeac44
@@ -1,7 +1,9 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export function isObject(maybe: unknown): maybe is { [key: string]: unknown } {
|
||||
return typeof maybe === 'object' && maybe !== null && !Array.isArray(maybe);
|
||||
return (
|
||||
typeof maybe === 'object' && maybe !== null && !Array.isArray(maybe) && !(maybe instanceof Date)
|
||||
);
|
||||
}
|
||||
|
||||
function isTraversable(maybe: unknown): maybe is IDataObject {
|
||||
@@ -13,7 +15,6 @@ function isTraversable(maybe: unknown): maybe is IDataObject {
|
||||
*/
|
||||
export function standardizeOutput(output: IDataObject) {
|
||||
function standardizeOutputRecursive(obj: IDataObject, knownObjects = new WeakSet()): IDataObject {
|
||||
if (obj === undefined || obj === null) return obj;
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (!isTraversable(value)) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user