(declarations: ReadonlyArray<DeclarationModel>)
| 589 | nodes.map((node) => node.getText().replace(/\/\*\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").trim()).join("\n") |
| 590 | |
| 591 | const fingerprintDeclarations = (declarations: ReadonlyArray<DeclarationModel>): string => { |
| 592 | const normalize = (value: unknown, parent?: string): unknown => { |
| 593 | if (Array.isArray(value)) { |
| 594 | return value.map((entry) => normalize(entry, parent)) |
| 595 | } |
| 596 | if (value !== null && typeof value === "object") { |
| 597 | const input = value as Record<string, unknown> |
| 598 | return Object.fromEntries( |
| 599 | Object.entries(input).flatMap(([key, entry]) => { |
| 600 | if ((parent === "parameters" && key === "name") || key === "displayName") { |
| 601 | return [] |
| 602 | } |
| 603 | return [[key, normalize(entry, key)]] |
| 604 | }) |
| 605 | ) |
| 606 | } |
| 607 | return value |
| 608 | } |
| 609 | return fingerprint( |
| 610 | declarations.map((declaration) => ({ |
| 611 | ...declaration, |
| 612 | name: "<export>", |
| 613 | parameters: declaration.parameters?.map((parameter) => ({ ...parameter, name: "<parameter>" })) |
| 614 | })).map((declaration) => normalize(declaration)) |
| 615 | ) |
| 616 | } |
| 617 | |
| 618 | interface PendingEntity { |
| 619 | readonly symbol: ts.Symbol |
no test coverage detected