Fix chart where properties contain periods

Fixes #281
This commit is contained in:
Thomas Nordquist
2020-04-16 10:53:50 +02:00
parent a89d7cf62e
commit 19e8bfdb37

View File

@@ -70,9 +70,11 @@ function jsonToPropertyPaths(ast: JsonAst, previousPath: Array<string> = []): Ar
} else if (ast.type === 'Array') { } else if (ast.type === 'Array') {
children = ast.children.map((value, idx) => jsonToPropertyPaths(value, previousPath.slice().concat([String(idx)]))) children = ast.children.map((value, idx) => jsonToPropertyPaths(value, previousPath.slice().concat([String(idx)])))
} else if (ast.type === 'Object') { } else if (ast.type === 'Object') {
children = ast.children.map((property) => children = ast.children.map((property) => {
jsonToPropertyPaths(property.value, previousPath.slice().concat([property.key.value])) const path = property.key.value.replace('.', '\\.')
)
return jsonToPropertyPaths(property.value, previousPath.slice().concat([path]))
})
} }
return children.reduce((a, b) => a.concat(b), []) return children.reduce((a, b) => a.concat(b), [])