Question For You Javascript Experts

Here is a Declaration written in 2 different ways. Both work.

Question:
Is there any preffered way to write it ?


*Option 1*
const {
        LayerKind
    } = require("photoshop").constants;

*Option 2*
const LayerKind = require("photoshop").constants;

They both work, but did you check what is the LayerKind in each case?

In first it’s an object of specifically layer kind constants. In second - it’s a Module object holding all Ps constants.

In first case you’d use it as LayerKind.CURVES
In second - LayerKind.LayerKind.CURVES

1 Like

@Karmalakas Thanks for the explanation. Just done a series of tests and I can now visualise how these work