Skip to content

Commit

Permalink
Update getLayer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-leech committed Nov 13, 2023
1 parent cacc06e commit 40fb4e0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mod/workspace/getLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,24 @@ module.exports = async (params) => {
return new Error('Unable to validate layer param.')
}

const layer = locale.layers[params.layer]
let layer = locale.layers[params.layer]

// Assign key value as key on layer object.
layer.key ??= params.layer

if (Object.hasOwn(workspace.templates, layer.template || layer.key)) {

merge(layer, await getTemplate(workspace.templates[layer.template || layer.key]))
// Merge the workspace template into the layer.
layer =
merge(await getTemplate(workspace.templates[layer.template || layer.key]),layer)
}

if (Array.isArray(layer.templates)) {

// Merge templates from templates array into layer.
layer.templates.forEach(async template => {
merge(layer, await getTemplate(workspace.templates[template]))
// Merge the workspace template into the layer.
layer =
merge(await getTemplate(workspace.templates[template]),layer)
})
}

Expand Down

0 comments on commit 40fb4e0

Please sign in to comment.