MCPcopy Create free account
hub / github.com/anomalyco/models.dev / stable

Function stable

packages/core/test/generate.test.ts:24–35  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

22}
23
24function stable(value: unknown): string {
25 if (Array.isArray(value)) {
26 return `[${value.map(stable).join(",")}]`;
27 }
28 if (value !== null && typeof value === "object") {
29 return `{${Object.entries(value)
30 .sort(([a], [b]) => a.localeCompare(b))
31 .map(([key, item]) => `${JSON.stringify(key)}:${stable(item)}`)
32 .join(",")}}`;
33 }
34 return JSON.stringify(value);
35}
36
37describe("catalog generation", () => {
38 test("base_model can factor metadata without changing provider JSON", async () => {

Callers 1

generate.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected