샘플
pathval 2.0.1: getPathValue
검증된 샘플 — npm pathval 2.0.1: getPathValue. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: getPathValue is exported as a function from the pathval…
sha256:1694bfc8bf02ef27e04c1cc1e7d8f4ce390450c4facff17f9d7b0cf760e9d7c7
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 getPathValue in pkg:npm/pathval@2.0.1
- 패키지
- 심벌
-
- getPathValue
- 생성일
- 2026-08-26T11:06:33Z
컨트랙트
- getPathValue is exported as a function from the pathval module
- getPathValue retrieves shallow and deeply nested object properties using dot-delimited path strings
- getPathValue retrieves array elements by index using bracket notation and supports chained object properties within arrays
- getPathValue resolves property keys containing literal dots and brackets when escaped with backslashes
- getPathValue returns undefined for non-existent direct properties and null when intermediate path segments do not exist
- getPathValue returns null without throwing when the target object is null or undefined
- getPathValue resolves property and index access on primitive values including string characters and string length
- getPathValue prevents prototype pollution by returning undefined when querying prototype, constructor, or __proto__ properties
- getPathValue accurately preserves and retrieves falsy values such as false, 0, empty string, and null
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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 getPathValue in pkg:npm/pathval@2.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/pathval@2.0.1
Demonstrate these symbols/APIs:
- getPathValue
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:d8480a77fe50424148a1c99b01a64954e9c218a43ab47a51b18d234d235be805","contract":["getPathValue is exported as a function from the pathval module","getPathValue retrieves shallow and deeply nested object properties using dot-delimited path strings","getPathValue retrieves array elements by index using bracket notation and supports chained object properties within arrays","getPathValue resolves property keys containing literal dots and brackets when escaped with backslashes","getPathValue returns undefined for non-existent direct properties and null when intermediate path segments do not exist","getPathValue returns null without throwing when the target object is null or undefined","getPathValue resolves property and index access on primitive values including string characters and string length","getPathValue prevents prototype pollution by returning undefined when querying prototype, constructor, or __proto__ properties","getPathValue accurately preserves and retrieves falsy values such as false, 0, empty string, and null"],"goal":"verify getPathValue in pkg:npm/pathval@2.0.1","kind":"HOW","packages":["pkg:npm/pathval@2.0.1"],"schemaVersion":1,"symbols":["getPathValue"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/pathval@2.0.1"],"schemaVersion":1,"subject":"pkg:npm/pathval@2.0.1","symbols":["getPathValue"],"verifierAdapter":"node-typescript@1"}
{
"name": "verify-pathval-get-path-value",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-pathval-get-path-value",
"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": "verify-pathval-get-path-value",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"pathval": "2.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify getPathValue in pkg:npm/pathval@2.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/pathval@2.0.1"
],
"symbols": [
"getPathValue"
]
}
import { getPathValue, getPathInfo, hasProperty, setPathValue } from 'pathval';
/**
* Retrieve the value located at a string path in an object.
*
* @param {Object} obj - Target object to query
* @param {string} path - Dot/bracket notation path (e.g. "a.b[0].c")
* @returns {*} The value at the path or undefined if not found
*/
export function getValueByPath(obj, path) {
return getPathValue(obj, path);
}
export { getPathValue, getPathInfo, hasProperty, setPathValue };
export default getPathValue;
import assert from 'node:assert/strict';
import { getPathValue } from 'pathval';
import { getValueByPath } from '../src/index.mjs';
// 1. Module export verification
{
assert.equal(typeof getPathValue, 'function');
assert.equal(typeof getValueByPath, 'function');
}
// 2. getPathValue retrieves shallow and deeply nested object properties using dot-delimited path strings
{
const data = {
user: {
name: 'Alice',
profile: {
age: 30,
city: 'Seoul'
}
},
version: '2.0.1'
};
assert.equal(getPathValue(data, 'version'), '2.0.1');
assert.equal(getPathValue(data, 'user.name'), 'Alice');
assert.equal(getPathValue(data, 'user.profile.age'), 30);
assert.equal(getPathValue(data, 'user.profile.city'), 'Seoul');
assert.equal(getValueByPath(data, 'user.name'), 'Alice');
}
// 3. getPathValue retrieves array elements by index using bracket notation and supports chained object properties within arrays
{
const catalog = {
departments: [
{
name: 'Engineering',
members: ['Alice', 'Bob'],
leads: [
{ role: 'Tech Lead', level: 5 },
{ role: 'Team Lead', level: 4 }
]
},
{
name: 'Design',
members: ['Charlie']
}
]
};
assert.equal(getPathValue(catalog, 'departments[0].name'), 'Engineering');
assert.equal(getPathValue(catalog, 'departments[0].members[0]'), 'Alice');
assert.equal(getPathValue(catalog, 'departments[0].members[1]'), 'Bob');
assert.equal(getPathValue(catalog, 'departments[0].leads[1].role'), 'Team Lead');
assert.equal(getPathValue(catalog, 'departments[1].name'), 'Design');
assert.equal(getPathValue(catalog, 'departments[1].members[0]'), 'Charlie');
}
// 4. getPathValue resolves property keys containing literal dots and brackets when escaped with backslashes
{
const complexKeys = {
'service.endpoint': 'https://example.com/api',
'matrix[0]': {
'nested.key': 42
},
config: {
'port:8080.ssl': true
}
};
assert.equal(getPathValue(complexKeys, 'service\\.endpoint'), 'https://example.com/api');
assert.equal(getPathValue(complexKeys, 'matrix\\[0\\].nested\\.key'), 42);
assert.equal(getPathValue(complexKeys, 'config.port:8080\\.ssl'), true);
}
// 5. getPathValue returns undefined for non-existent direct properties and null when intermediate path segments do not exist
{
const target = {
user: {
name: 'Alice'
}
};
assert.equal(getPathValue(target, 'unknown'), undefined);
assert.equal(getPathValue(target, 'user.missingField'), undefined);
assert.equal(getPathValue(target, 'user.missingField.nested'), null);
assert.equal(getPathValue(target, 'deeply.nested.non.existent.path'), null);
}
// 6. getPathValue returns null without throwing when the target object is null or undefined
{
assert.equal(getPathValue(null, 'user.name'), null);
assert.equal(getPathValue(undefined, 'user.name'), null);
assert.equal(getPathValue(null, 'items[0]'), null);
assert.equal(getPathValue(undefined, 'items[0]'), null);
}
// 7. getPathValue resolves property and index access on primitive values including string characters and string length
{
assert.equal(getPathValue('hello world', 'length'), 11);
assert.equal(getPathValue('hello', '[0]'), 'h');
assert.equal(getPathValue('hello', '[4]'), 'o');
assert.equal(getPathValue(12345, 'toString'), Number.prototype.toString);
}
// 8. getPathValue prevents prototype pollution by returning undefined when querying prototype, constructor, or __proto__ properties
{
const sampleObj = { data: 'valid' };
assert.equal(getPathValue(sampleObj, '__proto__'), undefined);
assert.equal(getPathValue(sampleObj, 'constructor'), undefined);
assert.equal(getPathValue(sampleObj, 'prototype'), undefined);
assert.equal(getPathValue(sampleObj, 'data.__proto__'), undefined);
}
// 9. getPathValue accurately preserves and retrieves falsy values such as false, 0, empty string, and null
{
const falsyData = {
flags: [false, 0, '', null, undefined, NaN],
settings: {
enabled: false,
count: 0,
prefix: '',
fallback: null
}
};
assert.equal(getPathValue(falsyData, 'flags[0]'), false);
assert.equal(getPathValue(falsyData, 'flags[1]'), 0);
assert.equal(getPathValue(falsyData, 'flags[2]'), '');
assert.equal(getPathValue(falsyData, 'flags[3]'), null);
assert.equal(getPathValue(falsyData, 'flags[4]'), undefined);
assert.ok(Number.isNaN(getPathValue(falsyData, 'flags[5]')));
assert.equal(getPathValue(falsyData, 'settings.enabled'), false);
assert.equal(getPathValue(falsyData, 'settings.count'), 0);
assert.equal(getPathValue(falsyData, 'settings.prefix'), '');
assert.equal(getPathValue(falsyData, 'settings.fallback'), null);
}
console.log('All pathval getPathValue contract tests passed successfully.');
오리진 시더
익명