Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function toCustomPropertiesReferences(object, parent, theme = object) {
const next = Array.isArray(object) ? [] : {}
for (const key in object) {
const value = object[key]
const name = join(parent, key)
if (obj(value)) {
next[key] = toCustomPropertiesReferences(value, name, theme)
continue
}
if (string(value)) {
next[key] = toVarValue(name, value)
continue
}
if (func(value)) {
next[key] = toVarValue(name, value({ theme }))
continue
}
}
return next
}
parent,
theme = object,
state = { value: '' },
) {
for (const key in object) {
const value = object[key]
const name = join(parent, key)
if (obj(value)) {
toCustomPropertiesDeclarations(value, name, theme, state)
continue
}
if (string(value)) {
state.value += `${toVarName(name)}: ${value};`
continue
}
if (func(value)) {
state.value += `${toVarName(name)}: ${value({ theme })};`
continue
}
}
return state.value
}