Last active
February 20, 2023 20:02
-
-
Save rmdes/fb85e5761814726c6576f395eb52339e to your computer and use it in GitHub Desktop.
Alternative "is it new" for the old function node block for N8N
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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