refactor(core): fixes n8n-local-rules/no-json-parse-json-stringify warnings (#4407)

* 🔨 fixes

* 🔨 set rule to error
This commit is contained in:
Michael Kret
2022-10-21 18:24:58 +03:00
committed by GitHub
parent e10128cbea
commit 9d6a2c32d7
21 changed files with 75 additions and 50 deletions

View File

@@ -6,6 +6,7 @@ import {
} from 'n8n-core';
import {
deepCopy,
ICredentialDataDecryptedObject,
IDataObject,
IHttpRequestOptions,
@@ -93,7 +94,7 @@ export function copyInputItem(item: INodeExecutionData, properties: string[]): I
if (item.json[property] === undefined) {
newItem[property] = null;
} else {
newItem[property] = JSON.parse(JSON.stringify(item.json[property]));
newItem[property] = deepCopy(item.json[property]);
}
}
return newItem;

View File

@@ -1,4 +1,4 @@
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
import { deepCopy, IDataObject, INodeExecutionData } from 'n8n-workflow';
import {
AdjustedPutItem,
@@ -103,7 +103,7 @@ export function copyInputItem(item: INodeExecutionData, properties: string[]): I
if (item.json[property] === undefined) {
newItem[property] = null;
} else {
newItem[property] = JSON.parse(JSON.stringify(item.json[property]));
newItem[property] = deepCopy(item.json[property]);
}
}
return newItem;