샘플
yallist 3.1.1
검증된 샘플 — npm yallist 3.1.1. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Yallist creates a doubly-linked list from an iterable or arguments
sha256:1b9dba190ab0f7048661c579dda15e3e01b905635770771397abd3df6e1f86ea
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
| 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-12 |
케이스
HOW- 목표
- verify pkg:npm/yallist@3.1.1
- 패키지
- 환경
- node 22.23.2
- 생성일
- 2026-08-21T15:45:34Z
컨트랙트
- Yallist creates a doubly-linked list from an iterable or arguments
- push and unshift insert elements at the tail and head respectively
- pop and shift remove and return elements from the tail and head respectively
- forEach and forEachReverse traverse elements in forward and reverse order
- map and mapReverse create new Yallist instances with transformed elements
- slice and sliceReverse extract sublists in forward and reverse order
- toArray and toArrayReverse convert the linked list to forward and reverse arrays
- pushNode, unshiftNode, and removeNode manipulate Node instances directly
- reverse reverses the linked list elements in place
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
소스
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/yallist@3.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/yallist@3.1.1
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- 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.
{"case":{"caseId":"case:sha256:34ac765352117d36ea682f7124d313b9c9b8b991fc16c646eee662c310815ca2","constraints":{"executionContext":"node"},"contract":["Yallist creates a doubly-linked list from an iterable or arguments","push and unshift insert elements at the tail and head respectively","pop and shift remove and return elements from the tail and head respectively","forEach and forEachReverse traverse elements in forward and reverse order","map and mapReverse create new Yallist instances with transformed elements","slice and sliceReverse extract sublists in forward and reverse order","toArray and toArrayReverse convert the linked list to forward and reverse arrays","pushNode, unshiftNode, and removeNode manipulate Node instances directly","reverse reverses the linked list elements in place"],"goal":"verify pkg:npm/yallist@3.1.1","kind":"HOW","packages":["pkg:npm/yallist@3.1.1"],"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/yallist@3.1.1"],"schemaVersion":1,"subject":"pkg:npm/yallist@3.1.1","verifierAdapter":"node-typescript@1"}
{
"name": "sample-yallist",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-yallist",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"yallist": "3.1.1"
}
},
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"license": "ISC"
}
}
}
{
"name": "sample-yallist",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for yallist",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"yallist": "3.1.1"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/yallist@3.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/yallist@3.1.1"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const Yallist = require('yallist');
function createList(...items) {
if (items.length === 1 && Array.isArray(items[0])) {
return new Yallist(items[0]);
}
return Yallist.create(...items);
}
function pushItems(list, ...items) {
list.push(...items);
return list;
}
function unshiftItems(list, ...items) {
list.unshift(...items);
return list;
}
function popItem(list) {
return list.pop();
}
function shiftItem(list) {
return list.shift();
}
function toArray(list) {
return list.toArray();
}
function toArrayReverse(list) {
return list.toArrayReverse();
}
function mapList(list, fn) {
return list.map(fn);
}
function mapListReverse(list, fn) {
return list.mapReverse(fn);
}
function reduceList(list, fn, initialValue) {
return list.reduce(fn, initialValue);
}
function reverseList(list) {
list.reverse();
return list;
}
module.exports = {
Yallist,
createList,
pushItems,
unshiftItems,
popItem,
shiftItem,
toArray,
toArrayReverse,
mapList,
mapListReverse,
reduceList,
reverseList
};
const assert = require('node:assert');
const Yallist = require('yallist');
const {
createList,
pushItems,
unshiftItems,
popItem,
shiftItem,
toArray,
toArrayReverse,
mapList,
mapListReverse,
reduceList,
reverseList
} = require('../src/index.js');
// 1. Creation from array / arguments / factory
const list1 = new Yallist([1, 2, 3]);
assert.strictEqual(list1.length, 3, 'initial array length should be 3');
assert.deepStrictEqual(list1.toArray(), [1, 2, 3], 'initial array values should match');
const list2 = createList('a', 'b', 'c');
assert.strictEqual(list2.length, 3, 'createList length should be 3');
assert.deepStrictEqual(toArray(list2), ['a', 'b', 'c'], 'createList values should match');
const list3 = createList([10, 20, 30]);
assert.strictEqual(list3.length, 3, 'createList from array length should be 3');
assert.deepStrictEqual(toArray(list3), [10, 20, 30], 'createList array values should match');
// 2. push and unshift
const list = new Yallist();
pushItems(list, 10);
pushItems(list, 20, 30);
assert.strictEqual(list.length, 3, 'length after push should be 3');
assert.deepStrictEqual(toArray(list), [10, 20, 30], 'values after push should match');
unshiftItems(list, 5);
assert.strictEqual(list.length, 4, 'length after unshift should be 4');
assert.deepStrictEqual(toArray(list), [5, 10, 20, 30], 'values after unshift should match');
// 3. pop and shift
assert.strictEqual(popItem(list), 30, 'pop should return last item');
assert.strictEqual(shiftItem(list), 5, 'shift should return first item');
assert.strictEqual(list.length, 2, 'length after pop/shift should be 2');
assert.deepStrictEqual(toArray(list), [10, 20], 'remaining values should match');
// 4. head, tail, get, getReverse
assert.strictEqual(list.head.value, 10, 'head value should be 10');
assert.strictEqual(list.tail.value, 20, 'tail value should be 20');
assert.strictEqual(list.get(0), 10, 'get(0) should be 10');
assert.strictEqual(list.get(1), 20, 'get(1) should be 20');
assert.strictEqual(list.getReverse(0), 20, 'getReverse(0) should be 20');
assert.strictEqual(list.getReverse(1), 10, 'getReverse(1) should be 10');
// 5. forEach and forEachReverse
const fwd = [];
list.forEach((item, index) => {
fwd.push({ item, index });
});
assert.deepStrictEqual(fwd, [
{ item: 10, index: 0 },
{ item: 20, index: 1 }
], 'forEach should traverse forward');
const rev = [];
list.forEachReverse((item, index) => {
rev.push({ item, index });
});
assert.deepStrictEqual(rev, [
{ item: 20, index: 1 },
{ item: 10, index: 0 }
], 'forEachReverse should traverse in reverse');
// 6. map, mapReverse, reduce, reduceReverse
const doubled = mapList(list, x => x * 2);
assert.ok(doubled instanceof Yallist, 'map result should be Yallist instance');
assert.deepStrictEqual(toArray(doubled), [20, 40], 'mapped values should be doubled');
const doubledRev = mapListReverse(list, x => x * 2);
assert.ok(doubledRev instanceof Yallist, 'mapReverse result should be Yallist instance');
assert.deepStrictEqual(toArray(doubledRev), [40, 20], 'mapReverse values should be reversed doubled');
const sum = reduceList(list, (acc, x) => acc + x, 0);
assert.strictEqual(sum, 30, 'reduce sum should be 30');
const strRev = list.reduceReverse((acc, x) => acc + '-' + x, 'start');
assert.strictEqual(strRev, 'start-20-10', 'reduceReverse string concatenation should match');
// 7. slice and sliceReverse
const multiList = new Yallist([1, 2, 3, 4, 5]);
const sliced = multiList.slice(1, 4);
assert.deepStrictEqual(toArray(sliced), [2, 3, 4], 'sliced values should match');
const slicedRev = multiList.sliceReverse(1, 4);
assert.deepStrictEqual(toArray(slicedRev), [4, 3, 2], 'slicedReverse values should match');
// 8. toArray and toArrayReverse
assert.deepStrictEqual(toArrayReverse(list), [20, 10], 'toArrayReverse should return reverse array');
// 9. Node manipulations: pushNode, unshiftNode, removeNode
const node = new Yallist.Node(99);
list.pushNode(node);
assert.strictEqual(list.tail, node, 'pushed node should be tail');
assert.strictEqual(list.tail.value, 99, 'tail value should match node value');
const headNode = new Yallist.Node(0);
list.unshiftNode(headNode);
assert.strictEqual(list.head, headNode, 'unshifted node should be head');
assert.strictEqual(list.head.value, 0, 'head value should match node value');
list.removeNode(node);
assert.strictEqual(list.tail.value, 20, 'tail should revert after node removal');
list.removeNode(headNode);
assert.strictEqual(list.head.value, 10, 'head should revert after head node removal');
// 10. reverse
reverseList(list);
assert.deepStrictEqual(toArray(list), [20, 10], 'reversed list array should match');
console.log('Contract tests passed successfully.');
오리진 시더
익명