Beispiel
flatted 3.4.3: toJSON
Verifiziertes Beispiel für npm flatted 3.4.3: toJSON. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: flatted.toJSON converts primitive…
sha256:409ab647c91f63e66d95a274377f536727b484865a868ae4e3c40bea0b0a202c
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-29 |
Fall
HOW- Ziel
- verify flatted.toJSON in pkg:npm/flatted@3.4.3
- Pakete
- Symbole
-
- flatted.toJSON
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-29T14:42:13Z
Contract
- flatted.toJSON converts primitive values into array representation
- flatted.toJSON converts objects and arrays into indexed flat array representation
- flatted.toJSON converts self-referencing circular objects into flat array representation without recursion errors
- flatted.toJSON converts mutually circular objects into flat array representation
- flatted.toJSON preserves shared object references across multiple properties with single indexed instance
- flatted.toJSON output serialized with JSON.stringify matches flatted.stringify output
- flatted.fromJSON reconstructs original circular object graph from flatted.toJSON output
- flatted.toJSON handles nested arrays containing objects and circular references
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify flatted.toJSON in pkg:npm/flatted@3.4.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/flatted@3.4.3
Demonstrate these symbols/APIs:
- flatted.toJSON
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:2a7ddb42c0228965c30b740dd47f567e7714306d51c6df4a7ec6296261b41f91","contract":["flatted.toJSON converts primitive values into array representation","flatted.toJSON converts objects and arrays into indexed flat array representation","flatted.toJSON converts self-referencing circular objects into flat array representation without recursion errors","flatted.toJSON converts mutually circular objects into flat array representation","flatted.toJSON preserves shared object references across multiple properties with single indexed instance","flatted.toJSON output serialized with JSON.stringify matches flatted.stringify output","flatted.fromJSON reconstructs original circular object graph from flatted.toJSON output","flatted.toJSON handles nested arrays containing objects and circular references"],"goal":"verify flatted.toJSON in pkg:npm/flatted@3.4.3","kind":"HOW","packages":["pkg:npm/flatted@3.4.3"],"schemaVersion":1,"symbols":["flatted.toJSON"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/flatted@3.4.3"],"schemaVersion":1,"subject":"pkg:npm/flatted@3.4.3","symbols":["flatted.toJSON"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-3979932717",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-3979932717",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"flatted": "3.4.3"
}
},
"node_modules/flatted": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.3.tgz",
"integrity": "sha512-/zipXxyO6rGvuNGDiULY9MvEGSkb2gaG4GGH4ygMi0ZZzyMHdUZBmntJmx5x1G2VuPytCwGN4xsJP6cw+sK+vQ==",
"license": "ISC"
}
}
}
{
"name": "sample-3979932717",
"version": "1.0.0",
"description": "verify flatted.toJSON in pkg:npm/flatted@3.4.3",
"main": "index.js",
"scripts": {
"test": "node test/contract.mjs"
},
"license": "MIT-0",
"dependencies": {
"flatted": "3.4.3"
}
}
{
"schemaVersion": 1,
"goal": "verify flatted.toJSON in pkg:npm/flatted@3.4.3",
"kind": "HOW",
"packages": [
"pkg:npm/flatted@3.4.3"
],
"symbols": [
"flatted.toJSON"
]
}
import assert from 'node:assert/strict';
import { toJSON, fromJSON, stringify } from 'flatted';
// 1. flatted.toJSON converts primitive values into array representation
{
assert.deepEqual(toJSON(42), [42]);
assert.deepEqual(toJSON('hello'), ['hello']);
assert.deepEqual(toJSON(true), [true]);
assert.deepEqual(toJSON(null), [null]);
}
// 2. flatted.toJSON converts objects and arrays into indexed flat array representation
{
const obj = { a: 1, b: 'two' };
const arr = toJSON(obj);
assert.ok(Array.isArray(arr));
assert.equal(arr[0].a, 1);
assert.equal(arr[0].b, '1');
assert.equal(arr[1], 'two');
const list = [10, 20, 30];
const listArr = toJSON(list);
assert.ok(Array.isArray(listArr));
assert.deepEqual(listArr[0], [10, 20, 30]);
}
// 3. flatted.toJSON converts self-referencing circular objects into flat array representation without recursion errors
{
const circular = { id: 1 };
circular.self = circular;
const jsonArr = toJSON(circular);
assert.ok(Array.isArray(jsonArr));
assert.equal(jsonArr[0].id, 1);
assert.equal(jsonArr[0].self, '0');
}
// 4. flatted.toJSON converts mutually circular objects into flat array representation
{
const a = { id: 1 };
const b = { id: 2 };
a.peer = b;
b.peer = a;
const jsonArr = toJSON(a);
assert.ok(Array.isArray(jsonArr));
assert.equal(jsonArr.length, 2);
assert.equal(jsonArr[0].id, 1);
assert.equal(jsonArr[0].peer, '1');
assert.equal(jsonArr[1].id, 2);
assert.equal(jsonArr[1].peer, '0');
}
// 5. flatted.toJSON preserves shared object references across multiple properties with single indexed instance
{
const shared = { value: 100 };
const container = { first: shared, second: shared };
const jsonArr = toJSON(container);
assert.ok(Array.isArray(jsonArr));
assert.equal(jsonArr[0].first, '1');
assert.equal(jsonArr[0].second, '1');
assert.equal(jsonArr[1].value, 100);
}
// 6. flatted.toJSON output serialized with JSON.stringify matches flatted.stringify output
{
const complex = { num: 1, str: 'test', list: [1, 2] };
complex.self = complex;
const viaToJSON = JSON.stringify(toJSON(complex));
const viaStringify = stringify(complex);
assert.equal(viaToJSON, viaStringify);
}
// 7. flatted.fromJSON reconstructs original circular object graph from flatted.toJSON output
{
const original = { id: 42, meta: 'data' };
original.cycle = original;
const jsonArr = toJSON(original);
const reconstructed = fromJSON(jsonArr);
assert.equal(reconstructed.id, 42);
assert.equal(reconstructed.meta, 'data');
assert.equal(reconstructed.cycle, reconstructed);
}
// 8. flatted.toJSON handles nested arrays containing objects and circular references
{
const item = { val: 1 };
const arr = [item, [item]];
item.parent = arr;
const jsonArr = toJSON(arr);
assert.ok(Array.isArray(jsonArr));
const restored = fromJSON(jsonArr);
assert.equal(restored[0].val, 1);
assert.equal(restored[1][0], restored[0]);
assert.equal(restored[0].parent, restored);
}
console.log('Contract passed');
Ursprungs-Seeder
anonym