サンプル
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
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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);
});
オリジンシーダー
匿名