샘플
object-assign 4.1.1: object-assign
검증된 샘플 — npm object-assign 4.1.1: object-assign. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: objectAssign exports a function that assigns…
sha256:56a8a907126a24e4bfae6d00b7f222dae6685e53cb93b2090e0e2c6ae741b14b
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-27 |
| 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 object-assign in pkg:npm/object-assign@4.1.1
- 심벌
-
- object-assign
- 환경
- node 22.23.2
- 생성일
- 2026-08-27T10:00:27Z
컨트랙트
- objectAssign exports a function that assigns enumerable own properties to target
- objectAssign mutates and returns the target object
- objectAssign merges multiple source objects with later sources overriding earlier ones
- objectAssign ignores null and undefined source arguments without throwing
- objectAssign throws TypeError when target is null or undefined
- objectAssign copies symbol-keyed enumerable own properties from sources
- objectAssign ignores non-enumerable properties and inherited prototype properties from sources
- applyDefaults creates a new object with merged defaults and custom options
파일
- 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 object-assign in pkg:npm/object-assign@4.1.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/object-assign@4.1.1
Demonstrate these symbols/APIs:
- object-assign
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:1dffad396ef785f7edc89dbba49211b801cc7dfd83946663e59a40b01e5cd041","contract":["objectAssign exports a function that assigns enumerable own properties to target","objectAssign mutates and returns the target object","objectAssign merges multiple source objects with later sources overriding earlier ones","objectAssign ignores null and undefined source arguments without throwing","objectAssign throws TypeError when target is null or undefined","objectAssign copies symbol-keyed enumerable own properties from sources","objectAssign ignores non-enumerable properties and inherited prototype properties from sources","applyDefaults creates a new object with merged defaults and custom options"],"goal":"verify object-assign in pkg:npm/object-assign@4.1.1","kind":"HOW","packages":["pkg:npm/object-assign@4.1.1"],"schemaVersion":1,"symbols":["object-assign"]},"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/object-assign@4.1.1"],"schemaVersion":1,"subject":"pkg:npm/object-assign@4.1.1","symbols":["object-assign"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-object-assign",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-object-assign",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"object-assign": "4.1.1"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-object-assign",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for object-assign@4.1.1",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"object-assign": "4.1.1"
}
}
{
"schemaVersion": 1,
"goal": "verify object-assign in pkg:npm/object-assign@4.1.1",
"kind": "HOW",
"packages": [
"pkg:npm/object-assign@4.1.1"
],
"symbols": [
"object-assign"
]
}
const objectAssign = require('object-assign');
/**
* Merges source objects into the target object and returns the mutated target.
*
* @param {Object} target - The target object to copy properties into.
* @param {...Object} sources - One or more source objects.
* @returns {Object} The target object with properties assigned.
*/
function mergeObjects(target, ...sources) {
return objectAssign(target, ...sources);
}
/**
* Creates a shallow clone of an object with default fallbacks and override values.
*
* @param {Object} defaults - Default properties.
* @param {Object} options - Custom options that override defaults.
* @returns {Object} A new object containing merged options.
*/
function applyDefaults(defaults, options) {
return objectAssign({}, defaults, options);
}
module.exports = {
objectAssign,
mergeObjects,
applyDefaults
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
objectAssign,
mergeObjects,
applyDefaults
} = require('../src/index.js');
async function testAll() {
// 1. objectAssign exports a function that assigns enumerable own properties to target
assert.equal(typeof objectAssign, 'function', 'objectAssign should be a function');
assert.equal(typeof mergeObjects, 'function', 'mergeObjects should be a function');
assert.equal(typeof applyDefaults, 'function', 'applyDefaults should be a function');
// 2. objectAssign mutates and returns the target object
const target = { initial: 'value' };
const source = { added: 123 };
const returnedTarget = objectAssign(target, source);
assert.equal(returnedTarget, target, 'objectAssign must return the identical target reference');
assert.deepEqual(target, { initial: 'value', added: 123 }, 'target object must be mutated');
// 3. objectAssign merges multiple source objects with later sources overriding earlier ones
const base = { a: 1, b: 2 };
const override1 = { b: 20, c: 30 };
const override2 = { c: 300, d: 400 };
const merged = objectAssign({}, base, override1, override2);
assert.deepEqual(merged, { a: 1, b: 20, c: 300, d: 400 }, 'later sources must override previous properties');
// 4. objectAssign ignores null and undefined source arguments without throwing
const targetWithNulls = { preserved: true };
const resultWithNulls = objectAssign(targetWithNulls, null, undefined, { next: 42 }, null);
assert.deepEqual(resultWithNulls, { preserved: true, next: 42 }, 'null and undefined sources must be skipped');
// 5. objectAssign throws TypeError when target is null or undefined
assert.throws(
() => {
objectAssign(null, { key: 'val' });
},
{
name: 'TypeError'
},
'objectAssign(null) must throw TypeError'
);
assert.throws(
() => {
objectAssign(undefined, { key: 'val' });
},
{
name: 'TypeError'
},
'objectAssign(undefined) must throw TypeError'
);
// 6. objectAssign copies symbol-keyed enumerable own properties from sources
const symA = Symbol('symA');
const symB = Symbol('symB');
const symbolSource = { [symA]: 'valueA', regular: 'text' };
Object.defineProperty(symbolSource, symB, {
value: 'hidden',
enumerable: false
});
const symbolTarget = {};
objectAssign(symbolTarget, symbolSource);
assert.equal(symbolTarget[symA], 'valueA', 'enumerable symbol property must be copied');
assert.equal(symbolTarget.regular, 'text', 'string key property must be copied');
assert.equal(symbolTarget[symB], undefined, 'non-enumerable symbol property must not be copied');
// 7. objectAssign ignores non-enumerable properties and inherited prototype properties from sources
const proto = { inheritedProp: 'inherited' };
const sourceWithProto = Object.create(proto);
sourceWithProto.ownProp = 'own';
Object.defineProperty(sourceWithProto, 'nonEnumProp', {
value: 'secret',
enumerable: false
});
const dest = {};
objectAssign(dest, sourceWithProto);
assert.equal(dest.ownProp, 'own', 'own enumerable property must be copied');
assert.equal(dest.inheritedProp, undefined, 'inherited property must not be copied');
assert.equal(dest.nonEnumProp, undefined, 'non-enumerable property must not be copied');
// 8. applyDefaults creates a new object with merged defaults and custom options
const defaultOpts = { timeout: 5000, retries: 3, verbose: false };
const customOpts = { timeout: 10000, verbose: true };
const resolved = applyDefaults(defaultOpts, customOpts);
assert.deepEqual(resolved, { timeout: 10000, retries: 3, verbose: true });
assert.notEqual(resolved, defaultOpts, 'must create a new object without mutating defaults');
assert.equal(defaultOpts.timeout, 5000, 'defaults must remain unmodified');
console.log('All object-assign contract tests passed successfully.');
}
testAll().catch((err) => {
console.error('Contract test failure:', err);
process.exit(1);
});
오리진 시더
익명