Skip to content

Instantly share code, notes, and snippets.

@rmdes
Last active February 20, 2023 20:02
Show Gist options
  • Save rmdes/fb85e5761814726c6576f395eb52339e to your computer and use it in GitHub Desktop.
Save rmdes/fb85e5761814726c6576f395eb52339e to your computer and use it in GitHub Desktop.
Alternative "is it new" for the old function node block for N8N
const new_items = [];
const data = this.getWorkflowStaticData('node');
data.ids = data.ids || [];
for (var i=0; i<items.length; i++) {
if (data.ids.includes(items[i].json.id)) {
break;
} else {
new_items.push({json: {id: items[i].json.id, url: items[i].json.url, name: items[i].json.name}});
}
}
data.ids = items.map(item => item.json.id)
return new_items;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment