CodeSampleX

Sample

object-inspect 1.14.0

Verified sample for npm object-inspect 1.14.0. The contract ran on node 22 · linux debian/x64 · docker and passed: inspectValue formats primitives (-0…

sha256:cfcc140d3eff53517ff13ca25e6466ffa9d804409dd8c229586345eef1985711

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
verify pkg:npm/object-inspect@1.14.0
Packages
Environment
node 22.23.2
Created
2026-11-22T01:09:12Z

Contract

  1. inspectValue formats primitives (-0, BigInt, null, undefined), plain structures, and null-prototype objects
  2. inspectValue handles circular references as [Circular] without throwing
  3. depth limits nested object and array inspection to [Object] and [Array]
  4. quoteStyle selects single or double quotes and maxStringLength truncates strings with remaining character count
  5. maxCollectionLength truncates arrays, Sets, and Maps with remaining item counts
  6. numericSeparator formats numbers and BigInts with underscores and multilineStrings preserves literal newlines
  7. indent and breakLength control single-line versus indented multi-line formatting
  8. customInspect honors true, 'symbol', and false for legacy inspect() and util.inspect.custom
  9. invalid quoteStyle, maxStringLength, maxCollectionLength, indent, breakLength, and customInspect options throw TypeError

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Download the source artifact (tar.gz)

Source

PROMPT.md
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.
csx.json
{"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"}
package-lock.json
{
  "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"
      }
    }
  }
}
package.json
{
  "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"
  }
}
spec.json
{
  "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"
  }
}
src/index.js
'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,
};
test/contract.js
'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');

Origin Seeder

anonymous