Exemple
object-inspect 1.14.0
Échantillon vérifié pour npm object-inspect 1.14.0. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:cfcc140d3eff53517ff13ca25e6466ffa9d804409dd8c229586345eef1985711
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-11-22 |
Cas
HOW- Objectif
- verify pkg:npm/object-inspect@1.14.0
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-11-22T01:09:12Z
Contrat
- inspectValue formats primitives (-0, BigInt, null, undefined), plain structures, and null-prototype objects
- inspectValue handles circular references as [Circular] without throwing
- depth limits nested object and array inspection to [Object] and [Array]
- quoteStyle selects single or double quotes and maxStringLength truncates strings with remaining character count
- maxCollectionLength truncates arrays, Sets, and Maps with remaining item counts
- numericSeparator formats numbers and BigInts with underscores and multilineStrings preserves literal newlines
- indent and breakLength control single-line versus indented multi-line formatting
- customInspect honors true, 'symbol', and false for legacy inspect() and util.inspect.custom
- invalid quoteStyle, maxStringLength, maxCollectionLength, indent, breakLength, and customInspect options throw TypeError
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
Code source
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 pkg:npm/object-inspect@1.14.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/object-inspect@1.14.0
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:7785ed9641f8358722bdf1510520ca5fa4d9d9f7990ea62adfa11073360ea0bc","constraints":{"executionContext":"node"},"contract":["inspectValue formats primitives (-0, BigInt, null, undefined), plain structures, and null-prototype objects","inspectValue handles circular references as [Circular] without throwing","depth limits nested object and array inspection to [Object] and [Array]","quoteStyle selects single or double quotes and maxStringLength truncates strings with remaining character count","maxCollectionLength truncates arrays, Sets, and Maps with remaining item counts","numericSeparator formats numbers and BigInts with underscores and multilineStrings preserves literal newlines","indent and breakLength control single-line versus indented multi-line formatting","customInspect honors true, 'symbol', and false for legacy inspect() and util.inspect.custom","invalid quoteStyle, maxStringLength, maxCollectionLength, indent, breakLength, and customInspect options throw TypeError"],"goal":"verify pkg:npm/object-inspect@1.14.0","kind":"HOW","packages":["pkg:npm/object-inspect@1.14.0"],"schemaVersion":1},"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/object-inspect@1.14.0"],"schemaVersion":1,"subject":"pkg:npm/object-inspect@1.14.0","verifierAdapter":"node-typescript@1"}
{
"name": "object-inspect-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "object-inspect-sample",
"version": "1.0.0",
"dependencies": {
"object-inspect": "1.14.0"
}
},
"node_modules/object-inspect": {
"version": "1.14.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.14.0.tgz",
"integrity": "sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
}
}
}
{
"name": "object-inspect-sample",
"version": "1.0.0",
"private": true,
"description": "Minimal contract sample verifying object-inspect 1.14.0 in CommonJS on Node.js",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"object-inspect": "1.14.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/object-inspect@1.14.0",
"kind": "HOW",
"packages": [
"pkg:npm/object-inspect@1.14.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const inspect = require('object-inspect');
function inspectValue(value, options) {
return inspect(value, options);
}
function inspectWithLimits(value, { depth, maxStringLength, maxCollectionLength, breakLength } = {}) {
const options = {};
if (depth !== undefined) {
options.depth = depth;
}
if (maxStringLength !== undefined) {
options.maxStringLength = maxStringLength;
}
if (maxCollectionLength !== undefined) {
options.maxCollectionLength = maxCollectionLength;
}
if (breakLength !== undefined) {
options.breakLength = breakLength;
}
return inspect(value, options);
}
module.exports = {
inspectValue,
inspectWithLimits,
};
'use strict';
const assert = require('node:assert/strict');
const util = require('node:util');
const { inspectValue, inspectWithLimits } = require('../src/index.js');
// 1. Primitives, negative zero, BigInt, null-prototype objects, and nested plain structures
assert.equal(inspectValue(undefined), 'undefined');
assert.equal(inspectValue(null), 'null');
assert.equal(inspectValue(-0), '-0');
assert.equal(inspectValue(42n), '42n');
assert.equal(inspectValue({ a: 1, b: [2, 'x'] }), "{ a: 1, b: [ 2, 'x' ] }");
const nullProto = Object.assign(Object.create(null), { k: 'v' });
assert.equal(inspectValue(nullProto), "[Object: null prototype] { k: 'v' }");
// 2. Circular references render [Circular] without throwing
const circular = { name: 'node' };
circular.self = circular;
assert.equal(inspectValue(circular), "{ name: 'node', self: [Circular] }");
// 3. depth option bounds nested object and array expansion
assert.equal(
inspectWithLimits({ a: { b: { c: 1 } } }, { depth: 1 }),
'{ a: [Object] }'
);
assert.equal(
inspectWithLimits([[1, 2]], { depth: 1 }),
'[ [Array] ]'
);
// 4. quoteStyle and maxStringLength options
assert.equal(inspectValue('hello', { quoteStyle: 'double' }), '"hello"');
assert.equal(
inspectWithLimits('abcdef', { maxStringLength: 3 }),
"'abc'... 3 more characters"
);
assert.equal(
inspectWithLimits('abcd', { maxStringLength: 3 }),
"'abc'... 1 more character"
);
// 5. maxCollectionLength option truncates arrays, Sets, and Maps
assert.equal(
inspectWithLimits([1, 2, 3, 4], { maxCollectionLength: 2 }),
'[ 1, 2, ... 2 more items ]'
);
assert.equal(
inspectWithLimits(new Set(['a', 'b', 'c']), { maxCollectionLength: 2 }),
"Set (3) {'a', 'b', ... 1 more item}"
);
assert.equal(
inspectWithLimits(new Map([['x', 1], ['y', 2], ['z', 3]]), { maxCollectionLength: 1 }),
"Map (3) {'x' => 1, ... 2 more items}"
);
// 6. numericSeparator, multilineStrings, indent, and breakLength options
assert.equal(inspectValue(1000000, { numericSeparator: true }), '1_000_000');
assert.equal(inspectValue(1000000n, { numericSeparator: true }), '1_000_000n');
assert.equal(inspectValue('line1\nline2'), "'line1\\nline2'");
assert.equal(inspectValue('line1\nline2', { multilineStrings: true }), "'line1\nline2'");
assert.equal(
inspectValue({ a: 1, b: 2 }, { indent: 2 }),
'{\n a: 1,\n b: 2\n}'
);
assert.equal(
inspectWithLimits({ alpha: 1, beta: 2, gamma: 3 }, { breakLength: 20 }),
'{\n alpha: 1,\n beta: 2,\n gamma: 3\n}'
);
assert.equal(
inspectWithLimits({ alpha: 1, beta: 2, gamma: 3 }, { breakLength: Infinity }),
'{ alpha: 1, beta: 2, gamma: 3 }'
);
// 7. customInspect supports true, 'symbol', and false
const withLegacyInspect = {
value: 1,
inspect() {
return '<legacy>';
},
};
const withSymbolInspect = {
value: 2,
[util.inspect.custom]() {
return '<symbol>';
},
};
assert.equal(inspectValue(withLegacyInspect), '<legacy>');
assert.equal(inspectValue(withLegacyInspect, { customInspect: 'symbol' }), '{ value: 1, inspect: [Function: inspect] }');
assert.equal(inspectValue(withSymbolInspect, { customInspect: 'symbol' }), '<symbol>');
assert.equal(
inspectValue(withSymbolInspect, { customInspect: false }),
'{ value: 2, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] }'
);
// 8. Invalid options throw TypeError
assert.throws(() => inspectValue('a', { quoteStyle: 'backtick' }), TypeError);
assert.throws(() => inspectValue('a', { maxStringLength: -1 }), TypeError);
assert.throws(() => inspectValue([1], { maxCollectionLength: 1.5 }), TypeError);
assert.throws(() => inspectValue({}, { indent: 0 }), TypeError);
assert.throws(() => inspectValue({}, { breakLength: -1 }), TypeError);
assert.throws(() => inspectValue({}, { customInspect: 'invalid' }), TypeError);
console.log('object-inspect@1.14.0 contract passed');
Seeder d'origine
anonyme