Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
presetData({ state }) {
// @TODO: figure out a better clone than JSONparse(JSONstringify())
const ajv = new Ajv({
removeAdditional: 'all'
})
ajv.addMetaSchema(jsd4)
const moduleNames = Object.keys(state.active).filter(
key => key.substring(key.length - 8, key.length) !== '-gallery'
)
const moduleData = moduleNames.reduce((obj, moduleName) => {
obj[moduleName] = {}
obj[moduleName].values = Object.keys(
state.active[moduleName].props || {}
).reduce((valuesObj, prop) => {
valuesObj[prop] = state.active[moduleName][prop]
return valuesObj
}, {})