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

Function normalize

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

Source from the content-addressed store, hash-verified

606
607const 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,

Callers 2

fingerprintDeclarationsFunction · 0.70
onEnterFunction · 0.50

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected