(declarations: ReadonlyArray<DeclarationModel>)
| 605 | nodes.map((node) => node.getText().replace(/\/\*\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").trim()).join("\n") |
| 606 | |
| 607 | const fingerprintDeclarations = (declarations: ReadonlyArray<DeclarationModel>): string => { |
| 608 | const normalize = (value: unknown, parent?: string): unknown => { |
| 609 | if (Array.isArray(value)) { |
| 610 | return value.map((entry) => normalize(entry, parent)) |
| 611 | } |
| 612 | if (value !== null && typeof value === "object") { |
| 613 | const input = value as Record<string, unknown> |
| 614 | return Object.fromEntries( |
| 615 | Object.entries(input).flatMap(([key, entry]) => { |
| 616 | if ((parent === "parameters" && key === "name") || key === "displayName") { |
| 617 | return [] |
| 618 | } |
| 619 | return [[key, normalize(entry, key)]] |
| 620 | }) |
| 621 | ) |
| 622 | } |
| 623 | return value |
| 624 | } |
| 625 | return fingerprint( |
| 626 | declarations.map((declaration) => ({ |
| 627 | ...declaration, |
| 628 | name: "<export>", |
| 629 | parameters: declaration.parameters?.map((parameter) => ({ ...parameter, name: "<parameter>" })) |
| 630 | })).map((declaration) => normalize(declaration)) |
| 631 | ) |
| 632 | } |
| 633 | |
| 634 | interface PendingEntity { |
| 635 | readonly symbol: ts.Symbol |
no test coverage detected