So I have this object:
const settings = {
js: {
files: [
{
src: './js/app.js',
name: 'script.js',
dest: 'public_html/js/'
},
{
src: './js/admin.js',
name: 'script.js',
dest: 'public_html/js/'
}
]
}
};
and I'd like to extract all the sources. Something like this:
sources = ['./js/app.js', './js/admin.js']
// or, at least
sources = [{'./js/app.js'}]
I know how to achieve this with a loop, but can I use ES6 destructuring instead?
Maybe something along these lines:
{sources = [{src}]} = config.js;
OR even:
{[{src}] : sources} = config.js;