(entity: ApiEntity)
| 42 | const entityFeatureCache = new WeakMap<ApiEntity, ReadonlySet<string>>() |
| 43 | |
| 44 | const entityFeatures = (entity: ApiEntity): ReadonlySet<string> => { |
| 45 | const cached = entityFeatureCache.get(entity) |
| 46 | if (cached !== undefined) { |
| 47 | return cached |
| 48 | } |
| 49 | const features = new Set<string>() |
| 50 | for (const declaration of entity.declarations) { |
| 51 | features.add(`declaration:${declaration.kind}`) |
| 52 | for (const member of declaration.members ?? []) { |
| 53 | features.add(`member:${member.kind}:${member.name}`) |
| 54 | } |
| 55 | } |
| 56 | entityFeatureCache.set(entity, features) |
| 57 | return features |
| 58 | } |
| 59 | |
| 60 | const setSimilarity = (left: ReadonlySet<string>, right: ReadonlySet<string>): number => { |
| 61 | if (left.size === 0 && right.size === 0) { |
no test coverage detected