Skip to content

Commit

Permalink
chore: code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Oct 26, 2023
1 parent 6c8e2dd commit 10a5354
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/extractStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
extract as styleExtractStyle,
STYLE_PREFIX,
} from './hooks/useStyleRegister';
import { toStyleStr } from './util';
import {
ATTR_CACHE_MAP,
serialize as serializeCacheMap,
} from './hooks/useStyleRegister/cacheMapUtil';
import { toStyleStr } from './util';
} from './util/cacheMapUtil';

const ExtractStyleFns = {
[STYLE_PREFIX]: styleExtractStyle,
Expand Down Expand Up @@ -45,9 +45,7 @@ export default function extractStyle(cache: Cache, plain = false) {

let styleText = '';

type ExtractedStyle = [order: number, styleStr: string];

const extractedStyles: ExtractedStyle[] = styleKeys
styleKeys
.map<[number, string] | null>((key) => {
const cachePath = key.replace(matchPrefixRegexp, '').replace(/%/g, '|');
const [prefix] = key.split('%');
Expand All @@ -62,9 +60,7 @@ export default function extractStyle(cache: Cache, plain = false) {
cachePathMap[cachePath] = styleId;
return [order, styleStr];
})
.filter(isNotNull);

extractedStyles
.filter(isNotNull)
.sort(([o1], [o2]) => o1 - o2)
.forEach(([, style]) => {
styleText += style;
Expand Down

0 comments on commit 10a5354

Please sign in to comment.