// destructuring assignment when passing
// an object of properties to a function
function example({userOptions: {query, all = true, sort} = {}, array}) {
console.log(query, all, sort) // something false ascending
}
// for clarity, the above example is destructured the same as this
function example({userOptions, array}){
const {query, all = true, sort} = userOptions || {}
}
const userOptions = {query: 'something', all: false, sort: 'ascending'}
const array = []
example({userOptions, array})