mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Remove linting exceptions in nodes-base (no-changelog) (#4944)
This commit is contained in:
@@ -78,7 +78,7 @@ export class Sandbox extends NodeVM {
|
||||
// anticipate user expecting `items` to pre-exist as in Function Item node
|
||||
if (error.message === 'items is not defined' && !/(let|const|var) items =/.test(script)) {
|
||||
const quoted = error.message.replace('items', '`items`');
|
||||
error.message = quoted + '. Did you mean `$input.all()`?';
|
||||
error.message = (quoted as string) + '. Did you mean `$input.all()`?';
|
||||
}
|
||||
|
||||
throw new ExecutionError(error);
|
||||
@@ -189,7 +189,7 @@ export class Sandbox extends NodeVM {
|
||||
// anticipate user expecting `item` to pre-exist as in Function Item node
|
||||
if (error.message === 'item is not defined' && !/(let|const|var) item =/.test(script)) {
|
||||
const quoted = error.message.replace('item', '`item`');
|
||||
error.message = quoted + '. Did you mean `$input.item.json`?';
|
||||
error.message = (quoted as string) + '. Did you mean `$input.item.json`?';
|
||||
}
|
||||
|
||||
throw new ExecutionError(error, this.itemIndex);
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
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);
|
||||
}
|
||||
|
||||
function isTraversable(maybe: unknown): maybe is IDataObject {
|
||||
return isObject(maybe) && typeof maybe.toJSON !== 'function' && Object.keys(maybe).length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stringify any non-standard JS objects (e.g. `Date`, `RegExp`) inside output items at any depth.
|
||||
*/
|
||||
@@ -16,14 +24,6 @@ export function standardizeOutput(output: IDataObject) {
|
||||
return output;
|
||||
}
|
||||
|
||||
export function isObject(maybe: unknown): maybe is { [key: string]: unknown } {
|
||||
return typeof maybe === 'object' && maybe !== null && !Array.isArray(maybe);
|
||||
}
|
||||
|
||||
function isTraversable(maybe: unknown): maybe is IDataObject {
|
||||
return isObject(maybe) && typeof maybe.toJSON !== 'function' && Object.keys(maybe).length > 0;
|
||||
}
|
||||
|
||||
export type CodeNodeMode = 'runOnceForAllItems' | 'runOnceForEachItem';
|
||||
|
||||
export const REQUIRED_N8N_ITEM_KEYS = new Set(['json', 'binary', 'pairedItem']);
|
||||
|
||||
Reference in New Issue
Block a user