style: 规范写法

This commit is contained in:
手瓜一十雪 committed 2024-10-15 09:11:00 +08:00
1 parent 0dc6aa46d0
commit 06e78f0550
4 files changed
+11 -8

No files matched your search

+6 -4
View File
@@ -15,10 +15,12 @@ function from(source: string) {
if (!capture) return null;
const [, type, attrs] = capture;
const data: Record<string, any> = {};
attrs && attrs.slice(1).split(',').forEach((str) => {
const index = str.indexOf('=');
data[str.slice(0, index)] = unescape(str.slice(index + 1));
});
if (attrs) {
attrs.slice(1).split(',').forEach((str) => {
const index = str.indexOf('=');
data[str.slice(0, index)] = unescape(str.slice(index + 1));
});
}
return { type, data, capture };
}