I am starting to look closely at API 2 but need to help to get me started.
How To Duplicate A Layer:
Looking at the docs, the following example code is supplied to duplicate a layer but simply copying and pasting doest work for me.
Can someone show me an example on how to use the following example code.
// duplicate a layer
const copyLayer = await layer.duplicate()
// extract to a new document
const exportDoc = psApp.documents[1]
const exportedLayer = await layer.duplicate(exportDoc)