summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
a3aca34)
If an identifier is not in use, its resolved value should be
`undefined`.
* of the `TagSystem` associated with this constructor.
*
* ※ If the I·R·I is not recognized, this function returns
* of the `TagSystem` associated with this constructor.
*
* ※ If the I·R·I is not recognized, this function returns
*/
fromIRI(iri) {
const system = this.#system;
*/
fromIRI(iri) {
const system = this.#system;
try {
// Attempt to resolve the identifier.
const instance = storage.get(identifier);
try {
// Attempt to resolve the identifier.
const instance = storage.get(identifier);
- return Tag.getSystem(instance) == system ? instance : null;
+ return Tag.getSystem(instance) == system
+ ? instance
+ : undefined;
} catch {
// Do not throw for bad identifiers.
} catch {
// Do not throw for bad identifiers.
* ☡ This function throws if the identifier is invalid.
*
* ※ If the identifier is valid but not recognized, this
* ☡ This function throws if the identifier is invalid.
*
* ※ If the identifier is valid but not recognized, this
- * function returns `null`.
+ * function returns `undefined`.
*/
fromIdentifier(identifier) {
const system = this.#system;
const storage = this.#storage;
const instance = storage.get(identifier);
*/
fromIdentifier(identifier) {
const system = this.#system;
const storage = this.#storage;
const instance = storage.get(identifier);
- return Tag.getSystem(instance) == system ? instance : null;
+ return Tag.getSystem(instance) == system
+ ? instance
+ : undefined;
* match the tagging entity of this constructor’s `TagSystem`.
*
* ※ If the specific component of the Tag U·R·I is not
* match the tagging entity of this constructor’s `TagSystem`.
*
* ※ If the specific component of the Tag U·R·I is not
- * recognized, this function returns `null`.
+ * recognized, this function returns `undefined`.
*/
fromTagURI(tagURI) {
const system = this.#system;
*/
fromTagURI(tagURI) {
const system = this.#system;
try {
// Attempt to resolve the identifier.
const instance = storage.get(identifier);
try {
// Attempt to resolve the identifier.
const instance = storage.get(identifier);
- return Tag.getSystem(instance) == system ? instance : null;
+ return Tag.getSystem(instance) == system
+ ? instance
+ : undefined;
} catch {
// Do not throw for bad identifiers.
} catch {
// Do not throw for bad identifiers.
assertStrictEquals(retrieved.identifier, identifier);
});
assertStrictEquals(retrieved.identifier, identifier);
});
- it("[[Call]] returns null if no tag with the given I·R·I has been persisted", () => {
+ it("[[Call]] returns undefined if no tag with the given I·R·I has been persisted", () => {
assertStrictEquals(
Tag.fromIRI(
`https://${system.authorityName}/tag:${system.taggingEntity}:000-0000`,
),
assertStrictEquals(
Tag.fromIRI(
`https://${system.authorityName}/tag:${system.taggingEntity}:000-0000`,
),
assertStrictEquals(retrieved.identifier, identifier);
});
assertStrictEquals(retrieved.identifier, identifier);
});
- it("[[Call]] returns null if no tag with the given identifier has been persisted", () => {
- assertStrictEquals(Tag.fromIdentifier("000-0000"), null);
+ it("[[Call]] returns undefined if no tag with the given identifier has been persisted", () => {
+ assertStrictEquals(Tag.fromIdentifier("000-0000"), undefined);
});
it("[[Call]] throws if passed an invalid identifier", () => {
});
it("[[Call]] throws if passed an invalid identifier", () => {
assertStrictEquals(retrieved.identifier, identifier);
});
assertStrictEquals(retrieved.identifier, identifier);
});
- it("[[Call]] returns null if no tag with the given Tag U·R·I has been persisted", () => {
+ it("[[Call]] returns undefined if no tag with the given Tag U·R·I has been persisted", () => {
assertStrictEquals(
Tag.fromTagURI(`tag:${system.taggingEntity}:`),
assertStrictEquals(
Tag.fromTagURI(`tag:${system.taggingEntity}:`),
);
assertStrictEquals(
Tag.fromTagURI(`tag:${system.taggingEntity}:000-0000`),
);
assertStrictEquals(
Tag.fromTagURI(`tag:${system.taggingEntity}:000-0000`),