});
}
- /** Adds the provided label(s) to this `Tag` as alternate labels. */
+ /**
+ * Adds the provided label(s) to this `Tag` as alternate labels, then
+ * returns this `Tag`.
+ */
addAltLabel(...labels) {
const altLabels = this.#data.altLabel;
let objectLabels = null; // initialized on first use
altLabels.add(literal);
}
}
+ return this;
}
/**
* Adds the provided tags to the list of tags that this `Tag` is
- * narrower than.
+ * narrower than, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
}
}
}
+ return this;
}
- /** Adds the provided label(s) to this `Tag` as hidden labels. */
+ /**
+ * Adds the provided label(s) to this `Tag` as hidden labels, then
+ * returns this `Tag`.
+ */
addHiddenLabel(...labels) {
const hiddenLabels = this.#data.hiddenLabel;
let objectLabels = null; // initialized on first use
hiddenLabels.add(literal);
}
}
+ return this;
}
/**
* Adds the provided tags to the list of tags that this `Tag` is in
- * canon with.
+ * canon with, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
}
}
}
+ return this;
}
/**
* Adds the provided tags to the list of tags that this `Tag`
- * involves.
+ * involves, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
}
}
}
+ return this;
}
/** Yields the alternative labels of this `Tag`. */
/**
* Removes the provided string label(s) from this `Tag` as alternate
- * labels.
+ * labels, then returns this `Tag`.
*/
deleteAltLabel(...labels) {
const altLabels = this.#data.altLabel;
altLabels.delete(literal);
}
}
+ return this;
}
/**
* Removes the provided tags from the list of tags that this `Tag` is
- * narrower than.
+ * narrower than, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
// Iterate over the provided tags and delete them.
broader.delete(toIdentifier($));
}
+ return this;
}
/**
* Removes the provided string label(s) from this `Tag` as hidden
- * labels.
+ * labels, then returns this `Tag`.
*/
deleteHiddenLabel(...labels) {
const hiddenLabels = this.#data.hiddenLabel;
hiddenLabels.delete(literal);
}
}
+ return this;
}
/**
* Removes the provided tags from the list of tags that this `Tag` is
- * in canon with.
+ * in canon with, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
// Iterate over the provided tags and delete them.
inCanon.delete(toIdentifier($));
}
+ return this;
}
/**
* Removes the provided tags from the list of tags that this `Tag`
- * involves.
+ * involves, then returns this `Tag`.
*
* Arguments may be string identifiers or objects with an
* `.identifier` property.
// Iterate over the provided tags and delete them.
involves.delete(toIdentifier($));
}
+ return this;
}
/** Yields `Tag`s that are in canon of this `Tag`. */
],
);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.addAltLabel(), tag);
+ });
});
describe("::addBroaderTag", () => {
);
});
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.addBroaderTag(), tag);
+ });
+
it("[[Call]] throws when adding a non‐persisted tag", () => {
const tag = new Tag();
assertThrows(() => {
],
);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.addHiddenLabel(), tag);
+ });
});
describe("::addInCanonTag", () => {
);
});
+ it("[[Call]] returns this", () => {
+ const tag = new Tag("EntityTag");
+ assertStrictEquals(tag.addInCanonTag(), tag);
+ });
+
it("[[Call]] throws when this is not a tag which can be placed in canon", () => {
assertThrows(() => {
new Tag().addInCanonTag();
);
});
+ it("[[Call]] returns this", () => {
+ const tag = new Tag("ConceptualTag");
+ assertStrictEquals(tag.addInvolvesTag(), tag);
+ });
+
it("[[Call]] throws when this is not a conceptual tag", () => {
assertThrows(() => {
new Tag().addInvolvesTag();
);
assertEquals([...tag.altLabels()], ["four"]);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.deleteAltLabel(), tag);
+ });
});
describe("::deleteBroaderTag", () => {
[broader2.identifier],
);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.deleteBroaderTag(), tag);
+ });
});
describe("::deleteHiddenLabel", () => {
);
assertEquals([...tag.hiddenLabels()], ["four"]);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag();
+ assertStrictEquals(tag.deleteHiddenLabel(), tag);
+ });
});
describe("::deleteInCanonTag", () => {
[canon2.identifier],
);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag("EntityTag");
+ assertStrictEquals(tag.deleteInCanonTag(), tag);
+ });
});
describe("::deleteInvolvesTag", () => {
[involved2.identifier],
);
});
+
+ it("[[Call]] returns this", () => {
+ const tag = new Tag("ConceptualTag");
+ assertStrictEquals(tag.deleteInvolvesTag(), tag);
+ });
});
describe("::hasInCanonTags", () => {