How to generate uuid at once for a large array of rows?

Hi
How to generate uuid at once for a large array of rows?
Now I have implemented a function for only one line?
I am using a script like this in the function node:

You can do the following:

const uuid = require('uuid');

items.forEach(item => {
  item.json.uuid = uuid.v4();
});

return items;

Here a full example:

2 Likes

Thanks
Its work