From 21c8a68bb58739650dbe481a50eb18944af33ec0 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Wed, 28 Aug 2024 09:46:20 +0200 Subject: [PATCH] code style --- src/modules/tagInfo.ts | 1 + src/transformers/globalStyle.ts | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/modules/tagInfo.ts b/src/modules/tagInfo.ts index a7b384e..38fa990 100644 --- a/src/modules/tagInfo.ts +++ b/src/modules/tagInfo.ts @@ -70,5 +70,6 @@ export const getTagInfo = async ({ export const removeSrcAttribute = (attributes: Record) => { const { src, ...rest } = attributes; + return rest; }; diff --git a/src/transformers/globalStyle.ts b/src/transformers/globalStyle.ts index 8f2c4f8..f51b933 100644 --- a/src/transformers/globalStyle.ts +++ b/src/transformers/globalStyle.ts @@ -83,18 +83,16 @@ const transformer: Transformer = async ({ map: options?.sourceMap ? { prev: map } : false, }); + if (attributes?.global) { + const { global, ...rest } = attributes; + + attributes = rest; + } + return { code: css, map: newMap, - attributes: - attributes && - Object.keys(attributes).reduce((acc: any, key) => { - if (key !== 'global') { - acc[key] = attributes[key]; - } - - return acc; - }, {}), + attributes, }; };