MCPcopy Create free account
hub / github.com/Effect-TS/effect / normalize

Function normalize

packages/tools/api-diff/src/Snapshot.ts:592–608  ·  view source on GitHub ↗
(value: unknown, parent?: string)

Source from the content-addressed store, hash-verified

590
591const 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,

Callers 1

fingerprintDeclarationsFunction · 0.70

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected