Lint and format src/compiler/compile/utils/get_slot_data.js

pull/8569/head
Simon Holthausen 3 years ago
parent f847c4d4c8
commit a2e2bacb3a

@ -19,7 +19,7 @@ export default function get_slot_data(values, block = null) {
};
}
const value = get_value(block, attribute);
return p `${attribute.name}: ${value}`;
return p`${attribute.name}: ${value}`;
})
};
}
@ -29,19 +29,19 @@ export default function get_slot_data(values, block = null) {
* @param {Attribute} attribute
*/
function get_value(block, attribute) {
if (attribute.is_true)
return x `true`;
if (attribute.chunks.length === 0)
return x `""`;
if (attribute.is_true) return x`true`;
if (attribute.chunks.length === 0) return x`""`;
let value = attribute.chunks
.map((chunk) => chunk.type === 'Text'
.map((chunk) =>
chunk.type === 'Text'
? string_literal(chunk.data)
: block
? chunk.manipulate(block)
: chunk.node)
.reduce((lhs, rhs) => x `${lhs} + ${rhs}`);
: chunk.node
)
.reduce((lhs, rhs) => x`${lhs} + ${rhs}`);
if (attribute.chunks.length > 1 && attribute.chunks[0].type !== 'Text') {
value = x `"" + ${value}`;
value = x`"" + ${value}`;
}
return value;
}
@ -53,7 +53,3 @@ function get_value(block, attribute) {
function get_spread_value(block, attribute) {
return block ? attribute.expression.manipulate(block) : attribute.expression.node;
}

Loading…
Cancel
Save