Skip to content

Commit

Permalink
值为空时不添加
Browse files Browse the repository at this point in the history
  • Loading branch information
na57 committed May 29, 2024
1 parent 785d908 commit 22278c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nagu-owl",
"version": "1.11.6",
"version": "1.11.7",
"description": "[![Node.js CI](https://github.com/nagucc/owl/actions/workflows/node.js.yml/badge.svg)](https://github.com/nagucc/owl/actions/workflows/node.js.yml)",
"type": "module",
"main": "dist/index.js",
Expand Down
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,13 @@ export class RdfsResource extends Notion<string> implements IRdfsResource {
await Promise.all(operations);

// 设置新值
const ts = await Promise.all([
this.setPropertyValue(rdfs.label, label),
this.setPropertyValue(rdfs.comment, comment),
this.setPropertyValue(rdfs.isDefinedBy, isDefinedBy as INotion<string>),
this.setPropertyValue(rdfs.seeAlso, seeAlso),
]);
const setOperations = [];
if (label) setOperations.push(this.setPropertyValue(rdfs.label, label));
if (comment) setOperations.push(this.setPropertyValue(rdfs.comment, comment));
if (isDefinedBy) setOperations.push(this.setPropertyValue(rdfs.isDefinedBy, isDefinedBy.toString()));
if (seeAlso) setOperations.push(this.setPropertyValue(rdfs.seeAlso, seeAlso));

const ts = await Promise.all(setOperations);

// 修改自身变量
this.label = ts[0]?.object;
Expand Down

0 comments on commit 22278c9

Please sign in to comment.