CodeSampleX

샘플

get-proto 1.0.1

검증된 샘플 — npm get-proto 1.0.1. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: getProto retrieves the prototype of a standard object literal

sha256:3a0a05a39b9096c509679f97dd50a52abfefae7b1ede496726c2418ad0d7931c

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 windows 11 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-19

케이스

HOW
목표
verify pkg:npm/get-proto@1.0.1
패키지
생성일
2026-08-18T18:00:00Z

컨트랙트

  1. getProto retrieves the prototype of a standard object literal
  2. getProto returns null for an object created with null prototype
  3. getProto traverses inheritance chain for custom prototype links
  4. getProto resolves class instance and derived class prototype links
  5. getProto retrieves built-in array and function prototypes
  6. wrapper function checkPrototype matches direct getProto behavior

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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/get-proto@1.0.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/get-proto@1.0.1

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:40d1bef46cdee594dd8eca75a06cd2ad75719dc9142360da03e923054044cfa8","contract":["getProto retrieves the prototype of a standard object literal","getProto returns null for an object created with null prototype","getProto traverses inheritance chain for custom prototype links","getProto resolves class instance and derived class prototype links","getProto retrieves built-in array and function prototypes","wrapper function checkPrototype matches direct getProto behavior"],"goal":"verify pkg:npm/get-proto@1.0.1","kind":"HOW","packages":["pkg:npm/get-proto@1.0.1"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","os":"windows","osVersionBucket":"11","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/get-proto@1.0.1"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
index.mjs
import getProto from 'get-proto';

/**
 * Retrieves the prototype of the provided object.
 * @param {object} obj
 * @returns {object | null}
 */
export function checkPrototype(obj) {
  return getProto(obj);
}

export default getProto;
package-lock.json
{
  "name": "sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample",
      "version": "1.0.0",
      "dependencies": {
        "get-proto": "1.0.1"
      }
    },
    "node_modules/call-bind-apply-helpers": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
      "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
      "license": "MIT",
      "dependencies": {
        "es-errors": "^1.3.0",
        "function-bind": "^1.1.2"
      },
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/dunder-proto": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
      "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
      "license": "MIT",
      "dependencies": {
        "call-bind-apply-helpers": "^1.0.1",
        "es-errors": "^1.3.0",
        "gopd": "^1.2.0"
      },
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/es-errors": {
      "version": "1.3.0",
      "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
      "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/es-object-atoms": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
      "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
      "license": "MIT",
      "dependencies": {
        "es-errors": "^1.3.0"
      },
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/function-bind": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
      "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
      "license": "MIT",
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    },
    "node_modules/get-proto": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
      "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
      "license": "MIT",
      "dependencies": {
        "dunder-proto": "^1.0.1",
        "es-object-atoms": "^1.0.0"
      },
      "engines": {
        "node": ">= 0.4"
      }
    },
    "node_modules/gopd": {
      "version": "1.2.0",
      "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
      "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.4"
      },
      "funding": {
        "url": "https://github.com/sponsors/ljharb"
      }
    }
  }
}
package.json
{
  "name": "sample",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "get-proto": "1.0.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/get-proto@1.0.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/get-proto@1.0.1"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import getProto from 'get-proto';
import { checkPrototype } from '../index.mjs';

// Case 1: getProto retrieves the prototype of a standard object literal
{
  const obj = { foo: 'bar' };
  const proto = getProto(obj);
  assert.equal(proto, Object.prototype, 'prototype of standard object should be Object.prototype');
}

// Case 2: getProto returns null for an object created with null prototype
{
  const nullProtoObj = Object.create(null);
  const proto = getProto(nullProtoObj);
  assert.equal(proto, null, 'prototype of null-prototype object should be null');
}

// Case 3: getProto traverses inheritance chain for custom prototype links
{
  const parent = { role: 'base' };
  const child = Object.create(parent);
  assert.equal(getProto(child), parent, 'prototype of child should be parent object');
  assert.equal(getProto(parent), Object.prototype, 'prototype of parent should be Object.prototype');
}

// Case 4: getProto resolves class instance and derived class prototype links
{
  class BaseEntity {}
  class UserEntity extends BaseEntity {}

  const user = new UserEntity();
  assert.equal(getProto(user), UserEntity.prototype, 'instance prototype should be UserEntity.prototype');
  assert.equal(getProto(UserEntity.prototype), BaseEntity.prototype, 'UserEntity prototype should be BaseEntity.prototype');
  assert.equal(getProto(BaseEntity.prototype), Object.prototype, 'BaseEntity prototype should be Object.prototype');
  assert.equal(getProto(UserEntity), BaseEntity, 'UserEntity class constructor prototype should be BaseEntity');
}

// Case 5: getProto retrieves built-in array and function prototypes
{
  const list = [10, 20, 30];
  assert.equal(getProto(list), Array.prototype, 'prototype of array should be Array.prototype');

  const fn = function testFunction() {};
  assert.equal(getProto(fn), Function.prototype, 'prototype of function should be Function.prototype');
}

// Case 6: wrapper function checkPrototype matches direct getProto behavior
{
  const sampleObj = { greeting: 'hello' };
  assert.equal(checkPrototype(sampleObj), getProto(sampleObj), 'checkPrototype wrapper should match direct getProto');
}

console.log('PASS: all get-proto contract assertions passed');

오리진 시더

익명