샘플
safe-stable-stringify 2.5.0: configure
검증된 샘플 — npm safe-stable-stringify 2.5.0: configure. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Calling safe-stable-stringify.configure…
sha256:747bf30351d648b805b3ddb3271daa17be275b7679d792fc61deebad576368fc
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
케이스
HOW- 목표
- verify safe-stable-stringify.configure in pkg:npm/safe-stable-stringify@2.5.0
- 심벌
-
- safe-stable-stringify.configure
- 환경
- node 22.23.2
- 생성일
- 2026-08-21T04:31:12Z
컨트랙트
- Calling safe-stable-stringify.configure returns a custom stringify function tailored with the specified options.
- Setting circularValue to a custom string replaces circular references with that string during serialization.
- Setting circularValue to TypeError causes serialization to throw a TypeError when a circular reference is encountered.
- Setting circularValue to undefined omits circular properties from the serialized JSON output.
- Setting deterministic to false preserves object property insertion order instead of sorting keys alphabetically.
- Setting bigint to true serializes BigInt values as numbers, while bigint: false omits BigInt properties.
- Setting maximumDepth limits nested serialization depth, replacing deeper objects with '[Object]' and arrays with '[Array]'.
- Setting maximumBreadth limits the number of serialized properties per object and appends a truncation summary.
- Setting strict to true throws an Error when encountering non-JSON-serializable values such as functions or NaN.
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.js
소스
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 safe-stable-stringify.configure in pkg:npm/safe-stable-stringify@2.5.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/safe-stable-stringify@2.5.0
Demonstrate these symbols/APIs:
- safe-stable-stringify.configure
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:df2874c6b142aabc6fa60aa909f07fcaf20de1e87de85cfbd26ee4bf2fecaec4","constraints":{"executionContext":"node"},"contract":["Calling safe-stable-stringify.configure returns a custom stringify function tailored with the specified options.","Setting circularValue to a custom string replaces circular references with that string during serialization.","Setting circularValue to TypeError causes serialization to throw a TypeError when a circular reference is encountered.","Setting circularValue to undefined omits circular properties from the serialized JSON output.","Setting deterministic to false preserves object property insertion order instead of sorting keys alphabetically.","Setting bigint to true serializes BigInt values as numbers, while bigint: false omits BigInt properties.","Setting maximumDepth limits nested serialization depth, replacing deeper objects with '[Object]' and arrays with '[Array]'.","Setting maximumBreadth limits the number of serialized properties per object and appends a truncation summary.","Setting strict to true throws an Error when encountering non-JSON-serializable values such as functions or NaN."],"goal":"verify safe-stable-stringify.configure in pkg:npm/safe-stable-stringify@2.5.0","kind":"HOW","packages":["pkg:npm/safe-stable-stringify@2.5.0"],"schemaVersion":1,"symbols":["safe-stable-stringify.configure"]},"contractCommand":["node","test/contract.js"],"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/safe-stable-stringify@2.5.0"],"schemaVersion":1,"subject":"pkg:npm/safe-stable-stringify@2.5.0","symbols":["safe-stable-stringify.configure"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-safe-stable-stringify",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-safe-stable-stringify",
"version": "1.0.0",
"dependencies": {
"safe-stable-stringify": "2.5.0"
}
},
"node_modules/safe-stable-stringify": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
"license": "MIT",
"engines": {
"node": ">=10"
}
}
}
}
{
"name": "sample-safe-stable-stringify",
"version": "1.0.0",
"private": true,
"description": "verify safe-stable-stringify.configure in pkg:npm/safe-stable-stringify@2.5.0",
"dependencies": {
"safe-stable-stringify": "2.5.0"
}
}
{
"schemaVersion": 1,
"goal": "verify safe-stable-stringify.configure in pkg:npm/safe-stable-stringify@2.5.0",
"kind": "HOW",
"packages": [
"pkg:npm/safe-stable-stringify@2.5.0"
],
"symbols": [
"safe-stable-stringify.configure"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert');
const { configure, stringify: defaultStringify } = require('safe-stable-stringify');
// 1. Default stringify behavior (deterministic key sorting and default circular marker)
{
const obj = { z: 1, a: 2, m: 3 };
assert.strictEqual(defaultStringify(obj), '{"a":2,"m":3,"z":1}');
const circ = { name: 'root' };
circ.self = circ;
assert.strictEqual(defaultStringify(circ), '{"name":"root","self":"[Circular]"}');
}
// 2. Custom circularValue string replaces circular references with that string
{
const customCircStringify = configure({ circularValue: '[CustomCircular]' });
const circ = { id: 1 };
circ.ref = circ;
assert.strictEqual(customCircStringify(circ), '{"id":1,"ref":"[CustomCircular]"}');
}
// 3. circularValue set to TypeError throws TypeError upon encountering a circular reference
{
const throwOnCircStringify = configure({ circularValue: TypeError });
const circ = { id: 1 };
circ.ref = circ;
assert.throws(
() => throwOnCircStringify(circ),
(err) => err instanceof TypeError && /circular/i.test(err.message)
);
}
// 4. circularValue set to undefined omits circular properties from serialized object
{
const omitCircStringify = configure({ circularValue: undefined });
const circ = { id: 1 };
circ.ref = circ;
assert.strictEqual(omitCircStringify(circ), '{"id":1}');
}
// 5. deterministic: false preserves object property insertion order
{
const nonDeterministicStringify = configure({ deterministic: false });
const obj = { z: 1, a: 2, m: 3 };
assert.strictEqual(nonDeterministicStringify(obj), '{"z":1,"a":2,"m":3}');
}
// 6. bigint option: true serializes BigInt as number, false omits BigInt properties
{
const bigintTrue = configure({ bigint: true });
const bigintFalse = configure({ bigint: false });
const obj = { num: 42, big: 100n };
assert.strictEqual(bigintTrue(obj), '{"big":100,"num":42}');
assert.strictEqual(bigintFalse(obj), '{"num":42}');
}
// 7. maximumDepth limits nested serialization depth, replacing deeper objects with '[Object]' and arrays with '[Array]'
{
const depthStringify = configure({ maximumDepth: 1 });
const nested = {
level0: 'ok',
nestedObj: { level1: 'hidden' },
nestedArr: [1, 2, 3]
};
assert.strictEqual(
depthStringify(nested),
'{"level0":"ok","nestedArr":"[Array]","nestedObj":"[Object]"}'
);
}
// 8. maximumBreadth limits properties serialized per object and appends truncation indicator
{
const breadthStringify = configure({ maximumBreadth: 2 });
const wide = { a: 1, b: 2, c: 3, d: 4 };
assert.strictEqual(
breadthStringify(wide),
'{"a":1,"b":2,"...":"2 items not stringified"}'
);
}
// 9. strict: true throws Error when encountering non-JSON-serializable values
{
const strictStringify = configure({ strict: true });
assert.throws(
() => strictStringify({ fn: () => {} }),
(err) => err instanceof Error && /Object can not safely be stringified/.test(err.message)
);
assert.throws(
() => strictStringify({ value: NaN }),
(err) => err instanceof Error && /Object can not safely be stringified/.test(err.message)
);
}
console.log('Contract verification passed.');
오리진 시더
익명