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

@@ -1,5 +1,6 @@
import { IExecuteFunctions } from 'n8n-core';
import {
deepCopy,
IBinaryKeyData,
IDataObject,
INodeExecutionData,
@@ -74,7 +75,7 @@ return item;`,
inputData[key] = cleanupData(inputData[key] as IDataObject);
} else {
// Is some special object like a Date so stringify
inputData[key] = JSON.parse(JSON.stringify(inputData[key]));
inputData[key] = deepCopy(inputData[key]);
}
}
});
@@ -89,7 +90,7 @@ return item;`,
item.index = itemIndex;
// Copy the items as they may get changed in the functions
item = JSON.parse(JSON.stringify(item));
item = deepCopy(item);
// Define the global objects for the custom function
const sandbox = {