Skip to content

Commit 84031f0

Browse files
authored
Merge pull request #639 from Suntgr/alpha
fix: Filter out the cases where the tagName is null
2 parents b01fedc + 00d7cf2 commit 84031f0

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/lb-annotation/src/utils/tool/TagUtils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ export default class TagUtil {
5959
const [key, value] = cur;
6060
if (value && value.length > 0) {
6161
const valueList = value.split(';');
62-
const nameList = {
63-
keyName: this.getTagKeyName(key, labelInfoSet),
64-
value: valueList.map((v: string) => this.getTagName([key, v], labelInfoSet)),
65-
};
66-
return [...acc, nameList];
62+
const keyName = this.getTagKeyName(key, labelInfoSet) ?? '';
63+
const values = valueList.map((v: string) => this.getTagName([key, v], labelInfoSet));
64+
// 只有当 keyName 存在才添加到结果中
65+
if (keyName.trim() !== '') {
66+
return [...acc, { keyName, value: values }];
67+
}
6768
}
6869
return acc;
6970
}, [])

0 commit comments

Comments
 (0)