You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
382 B
JavaScript
18 lines
382 B
JavaScript
export default function getAttrs(node) {
|
|
const { attribs, attributes } = node;
|
|
|
|
if (!attribs && attributes) {
|
|
const attrs = Reflect.ownKeys(attributes).reduce((acc, index) => {
|
|
const attr = attributes[index];
|
|
|
|
if (!attr.name || !attr.value) return acc;
|
|
|
|
acc[attr.name] = attr.value;
|
|
return acc;
|
|
}, {});
|
|
return attrs;
|
|
}
|
|
|
|
return attribs;
|
|
}
|