샘플
pathval 2.0.1
검증된 샘플 — npm pathval 2.0.1. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: getPathValue retrieves values from nested object structures by string…
sha256:f8f683c721fd655420c71aa9f07ea917e950a2335645a418acf3c49b4e77b546
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 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@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
| 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 |
케이스
HOW- 목표
- verify pkg:npm/pathval@2.0.1
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-26T09:39:19Z
컨트랙트
- getPathValue retrieves values from nested object structures by string path
- getPathValue supports array indexing in string paths
- setPathValue creates nested properties and sets value at string path
- getPathInfo returns parent object property name value and existence check
- hasProperty checks existence of own or inherited properties on objects and primitives
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
소스
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/pathval@2.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pathval@2.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.
{"case":{"caseId":"case:sha256:603cf19e7d23b723cca82081eb2470837210ef4e7c69764d76586dc8d710cda4","constraints":{"executionContext":"node"},"contract":["getPathValue retrieves values from nested object structures by string path","getPathValue supports array indexing in string paths","setPathValue creates nested properties and sets value at string path","getPathInfo returns parent object property name value and existence check","hasProperty checks existence of own or inherited properties on objects and primitives"],"goal":"verify pkg:npm/pathval@2.0.1","kind":"HOW","packages":["pkg:npm/pathval@2.0.1"],"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/pathval@2.0.1"],"schemaVersion":1,"subject":"pkg:npm/pathval@2.0.1","verifierAdapter":"node-typescript@1"}
{
"name": "sample-pathval",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-pathval",
"version": "1.0.0",
"dependencies": {
"pathval": "2.0.1"
}
},
"node_modules/pathval": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz",
"integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",
"license": "MIT",
"engines": {
"node": ">= 14.16"
}
}
}
}
{
"name": "sample-pathval",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of pathval property retrieval and mutation",
"type": "module",
"main": "src/index.js",
"dependencies": {
"pathval": "2.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/pathval@2.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/pathval@2.0.1"
]
}
import { getPathValue, setPathValue, getPathInfo, hasProperty } from 'pathval';
/**
* Retrieve a value from an object given a string path.
*
* @param {object} obj - The target object to inspect.
* @param {string} path - The string path (e.g. 'a.b[0].c').
* @returns {*} The value at the path or undefined.
*/
export function getValue(obj, path) {
return getPathValue(obj, path);
}
/**
* Set a value on an object at a given string path, creating intermediate objects/arrays as needed.
*
* @param {object} obj - The target object to mutate.
* @param {string} path - The string path (e.g. 'a.b.c').
* @param {*} value - The value to set.
* @returns {object} The mutated object.
*/
export function setValue(obj, path, value) {
return setPathValue(obj, path, value);
}
/**
* Inspect property metadata for a given path on an object.
*
* @param {object} obj - The target object to inspect.
* @param {string} path - The string path.
* @returns {{ parent: object, name: string|number, value: *, exists: boolean }} Property metadata.
*/
export function inspectPath(obj, path) {
return getPathInfo(obj, path);
}
/**
* Check whether an object or primitive has a specified property (own or prototype).
*
* @param {*} obj - The target to check.
* @param {string|symbol} name - The property name to look for.
* @returns {boolean} True if the property exists.
*/
export function propertyExists(obj, name) {
return hasProperty(obj, name);
}
export { getPathValue, setPathValue, getPathInfo, hasProperty };
import assert from 'node:assert';
import {
getValue,
setValue,
inspectPath,
propertyExists,
getPathValue,
setPathValue,
getPathInfo,
hasProperty,
} from '../src/index.js';
// 1. Function exports verification
assert.strictEqual(typeof getPathValue, 'function', 'getPathValue should be a function');
assert.strictEqual(typeof setPathValue, 'function', 'setPathValue should be a function');
assert.strictEqual(typeof getPathInfo, 'function', 'getPathInfo should be a function');
assert.strictEqual(typeof hasProperty, 'function', 'hasProperty should be a function');
assert.strictEqual(typeof getValue, 'function', 'getValue helper should be a function');
assert.strictEqual(typeof setValue, 'function', 'setValue helper should be a function');
assert.strictEqual(typeof inspectPath, 'function', 'inspectPath helper should be a function');
assert.strictEqual(typeof propertyExists, 'function', 'propertyExists helper should be a function');
// 2. getPathValue retrieves nested properties
const sampleData = {
user: {
profile: {
name: 'Alice',
details: {
age: 30,
city: 'Metropolis',
},
},
tags: ['admin', 'editor'],
},
};
assert.strictEqual(getPathValue(sampleData, 'user.profile.name'), 'Alice');
assert.strictEqual(getValue(sampleData, 'user.profile.details.city'), 'Metropolis');
assert.strictEqual(getPathValue(sampleData, 'user.profile.nonexistent'), undefined);
assert.strictEqual(getPathValue(sampleData, 'nonexistent.path'), null);
// 3. getPathValue supports array indexing
assert.strictEqual(getPathValue(sampleData, 'user.tags[0]'), 'admin');
assert.strictEqual(getPathValue(sampleData, 'user.tags[1]'), 'editor');
assert.strictEqual(getPathValue(sampleData, 'user.tags[2]'), undefined);
// 4. setPathValue creates nested properties and mutates objects
const targetObj = {};
setPathValue(targetObj, 'app.config.port', 8080);
assert.strictEqual(targetObj.app.config.port, 8080);
setValue(targetObj, 'app.config.features[0]', 'logging');
assert.strictEqual(targetObj.app.config.features[0], 'logging');
assert.strictEqual(Array.isArray(targetObj.app.config.features), true);
setPathValue(targetObj, 'app.config.title', 'Sample Application');
assert.strictEqual(getPathValue(targetObj, 'app.config.title'), 'Sample Application');
// 5. getPathInfo returns parent, name, value, and existence check
const info = getPathInfo(targetObj, 'app.config.port');
assert.strictEqual(info.name, 'port');
assert.strictEqual(info.value, 8080);
assert.strictEqual(info.exists, true);
assert.strictEqual(info.parent, targetObj.app.config);
const missingInfo = inspectPath(targetObj, 'app.config.missingKey');
assert.strictEqual(missingInfo.exists, false);
assert.strictEqual(missingInfo.value, undefined);
// 6. hasProperty checks own and prototype properties safely
assert.strictEqual(hasProperty({ x: 10 }, 'x'), true);
assert.strictEqual(hasProperty({ x: 10 }, 'y'), false);
assert.strictEqual(hasProperty('string-val', 'length'), true);
assert.strictEqual(hasProperty(null, 'any'), false);
assert.strictEqual(hasProperty(undefined, 'any'), false);
assert.strictEqual(propertyExists(['first', 'second'], 0), true);
assert.strictEqual(propertyExists(['first', 'second'], 5), false);
console.log('Contract tests passed successfully.');
오리진 시더
익명