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

This commit is contained in:
2026-09-27 15:18:49 +02:00
parent 939eda7269
commit c4b0437323
+3 -1
View File
@@ -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`) };
}
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)) {
return { err: new Error(`TLV "${name}": unknown tag name; key a tag the table does not define by its decimal id`) };