Update src/standalone.tsx

This commit is contained in:
Roman Hotsiy 2021-04-15 10:08:31 +03:00 committed by GitHub
parent 556f6b82e6
commit 419dbc71f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,13 +32,8 @@ function parseOptionsFromElement(element: Element) {
const res = {};
for (const attrName in attrMap) {
const optionName = attrName.replace(/-(.)/g, (_, $1) => $1.toUpperCase());
let attr = attrMap[attrName];
if (attrName === 'theme') {
attr = JSON.parse(attr);
}
res[optionName] = attr;
const attr = attrMap[attrName];
res[optionName] = attrName === 'theme' ? JSON.parse(attr) : attr;
// TODO: normalize options
}
return res;