Skip to content
Snippets Groups Projects
Verified Commit c568af07 authored by kPherox's avatar kPherox
Browse files

Fix parse object type config

parent 7f85e786
No related branches found
No related tags found
1 merge request!29Fix parse object type config
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
......@@ -104,8 +104,12 @@ export const parseTuples = (tuples, key) => {
nonAtomsTuples.includes(item.tuple[0])
? accum[item.tuple[0].substr(1)] = parseNonAtomTuples(item.tuple[1])
: accum[item.tuple[0].substr(1)] = parseTuples(item.tuple[1])
} else if (Array.isArray(item.tuple[1])) {
accum[item.tuple[0].substr(1)] = item.tuple[1]
} else if (item.tuple[1] && typeof item.tuple[1] === 'object' && 'tuple' in item.tuple[1]) {
accum[item.tuple[0].substr(1)] = item.tuple[1]['tuple'].join('.')
} else if (item.tuple[1] && typeof item.tuple[1] === 'object') {
accum[item.tuple[0].substr(1)] = parseObject(item.tuple[1])
} else {
key === 'mrf_user_allowlist'
? accum[item.tuple[0]] = item.tuple[1]
......@@ -122,6 +126,13 @@ const parseNonAtomTuples = (tuples) => {
}, {})
}
const parseObject = (object) => {
return Object.keys(object).reduce((acc, item) => {
acc[item.substr(1)] = object[item]
return acc
}, {})
}
export const valueHasTuples = (key, value) => {
const valueIsArrayOfNonObjects = Array.isArray(value) && value.length > 0 && typeof value[0] !== 'object'
return key === 'meta' ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment