CodeSampleX

Sample

object-inspect 1.13.4

Verified sample for npm object-inspect 1.13.4. The contract ran on node 22 · linux alpine/x64 · docker and passed: formatValue returns formatted string…

sha256:d288f274c1109d7a141e8179af8ee2b0d3fc78029569b6bca6562801bf918fb8

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
2
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 alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-20
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-09-07

Case

HOW
Goal
verify pkg:npm/object-inspect@1.13.4
Packages
Environment
node 22.23.2
Created
2026-08-20T13:26:05Z

Contract

  1. formatValue returns formatted string representations for objects and primitives
  2. formatObject safely inspects circular data structures without throwing
  3. supports depth option to limit inspection depth of nested structures
  4. supports quoteStyle option for choosing single or double string quotes
  5. supports maxStringLength option to truncate strings exceeding maximum length

Files

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

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.13.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/object-inspect@1.13.4
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:ca4ad612bbf6d228537016f382bdc9b7c71bc6adae6aa20876ae0283effa10e4","constraints":{"executionContext":"node"},"contract":["formatValue returns formatted string representations for objects and primitives","formatObject safely inspects circular data structures without throwing","supports depth option to limit inspection depth of nested structures","supports quoteStyle option for choosing single or double string quotes","supports maxStringLength option to truncate strings exceeding maximum length"],"goal":"verify pkg:npm/object-inspect@1.13.4","kind":"HOW","packages":["pkg:npm/object-inspect@1.13.4"],"schemaVersion":1},"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/object-inspect@1.13.4"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-object-inspect",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-object-inspect",
      "version": "1.0.0",
      "dependencies": {
        "object-inspect": "1.13.4"
      }
    },
    "node_modules/object-inspect": {
      "version": "1.13.4",
      "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
      "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    }
  }
}
package.json
{
  "name": "sample-object-inspect",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of object-inspect",
  "main": "src/index.js",
  "dependencies": {
    "object-inspect": "1.13.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/object-inspect@1.13.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/object-inspect@1.13.4"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const inspect = require('object-inspect');

/**
 * Format a value or object using object-inspect with optional custom options.
 * @param {*} value - The value to inspect
 * @param {object} [options] - Options passed to object-inspect
 * @returns {string} Formatted string representation
 */
function formatValue(value, options) {
  return inspect(value, options);
}

/**
 * Format an object safely even with circular references or deep nesting.
 * @param {object} obj - Object to format safely
 * @param {object} [options] - Options
 * @returns {string} Formatted string representation
 */
function formatObject(obj, options = {}) {
  return inspect(obj, {
    depth: 5,
    ...options
  });
}

module.exports = {
  formatValue,
  formatObject,
  inspect
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const { formatValue, formatObject, inspect } = require('../src/index.js');

// 1. Export verification
assert.strictEqual(typeof inspect, 'function', 'inspect should be exported as a function');
assert.strictEqual(typeof formatValue, 'function', 'formatValue should be a function');
assert.strictEqual(typeof formatObject, 'function', 'formatObject should be a function');

// 2. Format primitive and object structures
const obj = { name: 'sample', count: 42, active: true };
const objFormatted = formatValue(obj);
assert.strictEqual(objFormatted, "{ name: 'sample', count: 42, active: true }");

const arr = [1, 2, 'three'];
assert.strictEqual(formatValue(arr), "[ 1, 2, 'three' ]");

// 3. Handle circular references safely without throwing
const circular = { id: 1 };
circular.self = circular;
const circularResult = formatObject(circular);
assert.strictEqual(circularResult, '{ id: 1, self: [Circular] }');

// 4. Respect depth option for nested structures
const deep = { level1: { level2: { level3: 'deepValue' } } };
const shallowResult = formatValue(deep, { depth: 1 });
assert.strictEqual(shallowResult, '{ level1: [Object] }');

// 5. Support quoteStyle and maxStringLength options
const doubleQuote = formatValue('hello world', { quoteStyle: 'double' });
assert.strictEqual(doubleQuote, '"hello world"');

const truncated = formatValue('supercalifragilistic', { maxStringLength: 5 });
assert.strictEqual(truncated, "'super'... 15 more characters");

console.log('Contract tests passed successfully.');

Origin Seeder

anonymous