Read a named tag's definition once in tagIdOf()
Mirror / push (push) Successful in 4s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 30s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 31s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 31s
Mirror / push (push) Successful in 4s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 30s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 31s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 31s
This commit is contained in:
+3
-1
@@ -135,7 +135,9 @@ function tagIdOf(name: string, input: object): Result<{ tagId: number }> {
|
|||||||
return { err: new Error(`TLV "${name}": key it by its name, or a tag the table does not define by its decimal id, instead of giving a tagId`) };
|
return { err: new Error(`TLV "${name}": key it by its name, or a tag the table does not define by its decimal id, instead of giving a tagId`) };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.hasOwn(tlvs, name)) return { tagId: tlvs[name]?.id ?? 0 };
|
const named = Object.hasOwn(tlvs, name) ? tlvs[name] : undefined;
|
||||||
|
|
||||||
|
if (named) return { tagId: named.id };
|
||||||
|
|
||||||
if (!/^(0|[1-9]\d*)$/.test(name)) {
|
if (!/^(0|[1-9]\d*)$/.test(name)) {
|
||||||
return { err: new Error(`TLV "${name}": unknown tag name; key a tag the table does not define by its decimal id`) };
|
return { err: new Error(`TLV "${name}": unknown tag name; key a tag the table does not define by its decimal id`) };
|
||||||
|
|||||||
Reference in New Issue
Block a user