Commit 1549d0b
committed
Reduce cast repetition in getLdSignatureObject
Destructure `signature` from `jsonLd` once after the initial type
guard, instead of repeating `jsonLd as { signature?: unknown }` for
each of the three follow-up checks. Two early returns also replace
the original chained conditions, which reads more naturally.
Keep the return type as `Record<string, unknown> | undefined`. The
caller in `verifyJsonLd` reads `sig.creator`, `sig.signatureValue`,
and `sig.type` as string properties; switching to `object | undefined`
would push the cast burden into the caller at every property access,
trading one local cast for three remote ones.
#769 (comment)
Assisted-by: Claude Code:claude-opus-4-71 parent 1c7105b commit 1549d0b
1 file changed
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 466 | + | |
470 | 467 | | |
471 | | - | |
| 468 | + | |
472 | 469 | | |
473 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
474 | 478 | | |
475 | 479 | | |
476 | 480 | | |
| |||
0 commit comments