From 22278c95d7598547494776d1b62920c1c9e600e1 Mon Sep 17 00:00:00 2001 From: na57 Date: Wed, 29 May 2024 10:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=80=BC=E4=B8=BA=E7=A9=BA=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 808f62c..1da5352 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index.ts b/src/index.ts index d09d29a..9c3cac8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -144,12 +144,13 @@ export class RdfsResource extends Notion 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), - 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;