샘플
lodash 4.18.1: Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep
검증된 샘플 — npm lodash 4.18.1: Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep. node 22 · linux…
sha256:ee9930a6c5ca6fe8600da13df5c464b1aba71ca62aa6c023d046f30fda69e83f
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-23 |
| 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-08 |
케이스
HOW- 목표
- Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep
- 패키지
- 심벌
-
- cloneDeep
- 생성일
- 2026-08-23T05:55:59Z
컨트랙트
- cloneDeep recursively clones nested plain objects and arrays into distinct new references
- Mutating cloned nested objects or nested arrays does not affect the original source
- cloneDeep accurately preserves and copies Date, RegExp, Set, and Map instances with independent contents
- cloneDeep correctly preserves circular references and cyclical structures without infinite recursion
- cloneDeep returns primitive values directly without modification
- cloneDeep accurately clones typed arrays and ArrayBuffer instances
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
소스
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: Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/lodash@4.18.1
Demonstrate these symbols/APIs:
- cloneDeep
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:78f8d5f54f5cd53d644e02d14a8c4ca47319fca9c5dfa8a18163c6065159543a","contract":["cloneDeep recursively clones nested plain objects and arrays into distinct new references","Mutating cloned nested objects or nested arrays does not affect the original source","cloneDeep accurately preserves and copies Date, RegExp, Set, and Map instances with independent contents","cloneDeep correctly preserves circular references and cyclical structures without infinite recursion","cloneDeep returns primitive values directly without modification","cloneDeep accurately clones typed arrays and ArrayBuffer instances"],"goal":"Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep","kind":"HOW","packages":["pkg:npm/lodash@4.18.1"],"schemaVersion":1,"symbols":["cloneDeep"]},"contractCommand":["node","test/contract.cjs"],"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/lodash@4.18.1"],"schemaVersion":1,"subject":"pkg:npm/lodash@4.18.1","symbols":["cloneDeep"],"verifierAdapter":"node-typescript@1"}
{
"name": "lodash-clonedeep-verification",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "lodash-clonedeep-verification",
"version": "1.0.0",
"dependencies": {
"lodash": "4.18.1"
}
},
"node_modules/lodash": {
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
"license": "MIT"
}
}
}
{
"name": "lodash-clonedeep-verification",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification for lodash cloneDeep",
"dependencies": {
"lodash": "4.18.1"
}
}
{
"schemaVersion": 1,
"goal": "Deep clone complex nested objects, arrays, and custom values preserving reference independence with cloneDeep",
"kind": "HOW",
"packages": [
"pkg:npm/lodash@4.18.1"
],
"symbols": [
"cloneDeep"
]
}
const assert = require('node:assert');
const { cloneDeep } = require('lodash');
// 1. cloneDeep recursively clones nested plain objects and arrays into distinct new references
const original = {
name: 'CodeSampleX',
meta: {
version: 1,
tags: ['build', 'test']
},
counts: [10, 20, [30, 40]]
};
const cloned = cloneDeep(original);
assert.deepStrictEqual(cloned, original);
assert.notStrictEqual(cloned, original);
assert.notStrictEqual(cloned.meta, original.meta);
assert.notStrictEqual(cloned.meta.tags, original.meta.tags);
assert.notStrictEqual(cloned.counts, original.counts);
assert.notStrictEqual(cloned.counts[2], original.counts[2]);
// 2. Mutating cloned nested objects or nested arrays does not affect the original source
cloned.meta.version = 2;
cloned.meta.tags.push('verify');
cloned.counts[2].push(50);
assert.strictEqual(original.meta.version, 1);
assert.deepStrictEqual(original.meta.tags, ['build', 'test']);
assert.deepStrictEqual(original.counts[2], [30, 40]);
// 3. cloneDeep accurately preserves and copies Date, RegExp, Set, and Map instances with independent contents
const date = new Date('2026-08-23T00:00:00.000Z');
const regex = /test-[a-z]+/gi;
const set = new Set(['alpha', 'beta']);
const map = new Map([['key1', { value: 100 }]]);
const complexObj = { date, regex, set, map };
const complexCloned = cloneDeep(complexObj);
assert.ok(complexCloned.date instanceof Date);
assert.strictEqual(complexCloned.date.getTime(), date.getTime());
assert.notStrictEqual(complexCloned.date, date);
assert.ok(complexCloned.regex instanceof RegExp);
assert.strictEqual(complexCloned.regex.source, regex.source);
assert.strictEqual(complexCloned.regex.flags, regex.flags);
assert.notStrictEqual(complexCloned.regex, regex);
assert.ok(complexCloned.set instanceof Set);
assert.strictEqual(complexCloned.set.size, 2);
assert.ok(complexCloned.set.has('alpha'));
assert.notStrictEqual(complexCloned.set, set);
complexCloned.set.add('gamma');
assert.strictEqual(set.has('gamma'), false);
assert.ok(complexCloned.map instanceof Map);
assert.strictEqual(complexCloned.map.size, 1);
assert.notStrictEqual(complexCloned.map, map);
assert.notStrictEqual(complexCloned.map.get('key1'), map.get('key1'));
assert.deepStrictEqual(complexCloned.map.get('key1'), { value: 100 });
// 4. cloneDeep correctly preserves circular references and cyclical structures without infinite recursion
const cyclicObj = { id: 'parent' };
cyclicObj.self = cyclicObj;
cyclicObj.child = { parent: cyclicObj };
const cyclicCloned = cloneDeep(cyclicObj);
assert.strictEqual(cyclicCloned.id, 'parent');
assert.strictEqual(cyclicCloned.self, cyclicCloned);
assert.strictEqual(cyclicCloned.child.parent, cyclicCloned);
assert.notStrictEqual(cyclicCloned, cyclicObj);
assert.notStrictEqual(cyclicCloned.child, cyclicObj.child);
// 5. cloneDeep returns primitive values directly without modification
assert.strictEqual(cloneDeep(42), 42);
assert.strictEqual(cloneDeep('sample-string'), 'sample-string');
assert.strictEqual(cloneDeep(true), true);
assert.strictEqual(cloneDeep(null), null);
assert.strictEqual(cloneDeep(undefined), undefined);
const sym = Symbol('token');
assert.strictEqual(cloneDeep(sym), sym);
// 6. cloneDeep accurately clones typed arrays and ArrayBuffer instances
const uint8 = new Uint8Array([1, 2, 3, 4]);
const clonedUint8 = cloneDeep(uint8);
assert.ok(clonedUint8 instanceof Uint8Array);
assert.deepStrictEqual(Array.from(clonedUint8), [1, 2, 3, 4]);
assert.notStrictEqual(clonedUint8, uint8);
clonedUint8[0] = 99;
assert.strictEqual(uint8[0], 1);
console.log('Contract passed');
오리진 시더
익명