Sample
define-properties 1.2.1: define properties on object conditionally with predicates and support descriptor flags
Verified sample for npm define-properties 1.2.1: define properties on object conditionally with predicates and support descriptor flags. The contract ran on…
sha256:d365222abe961312521639edda7754eba1be4816d95a68bb649c8ae25e53d493
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- define properties on object conditionally with predicates and support descriptor flags
- Packages
- Symbols
-
- defineProperties
- defineProperties.supportsDescriptors
- Created
- 2026-08-26T09:01:31Z
Contract
- defineProperties defines non-enumerable, writable, configurable properties on target object
- defineProperties preserves existing properties when predicates are not provided or falsy
- defineProperties overwrites existing properties when predicate is boolean true and value differs
- defineProperties overwrites existing properties when predicate function returns truthy
- defineProperties does not overwrite existing properties when predicate function returns falsy
- defineProperties supports symbol keyed properties on target object
- defineProperties.supportsDescriptors is a boolean indicating descriptor support
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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: define properties on object conditionally with predicates and support descriptor flags
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/define-properties@1.2.1
Demonstrate these symbols/APIs:
- defineProperties
- defineProperties.supportsDescriptors
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:bb7aab037f5ebca0ee636667f571c927cbb0bb070eb2b3a496a251f35ac007bf","contract":["defineProperties defines non-enumerable, writable, configurable properties on target object","defineProperties preserves existing properties when predicates are not provided or falsy","defineProperties overwrites existing properties when predicate is boolean true and value differs","defineProperties overwrites existing properties when predicate function returns truthy","defineProperties does not overwrite existing properties when predicate function returns falsy","defineProperties supports symbol keyed properties on target object","defineProperties.supportsDescriptors is a boolean indicating descriptor support"],"goal":"define properties on object conditionally with predicates and support descriptor flags","kind":"HOW","packages":["pkg:npm/define-properties@1.2.1"],"schemaVersion":1,"symbols":["defineProperties","defineProperties.supportsDescriptors"]},"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/define-properties@1.2.1"],"schemaVersion":1,"subject":"pkg:npm/define-properties@1.2.1","symbols":["defineProperties","defineProperties.supportsDescriptors"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-define-properties",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-define-properties",
"version": "1.0.0",
"dependencies": {
"define-properties": "1.2.1"
}
},
"node_modules/define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/define-properties": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
"integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
"license": "MIT",
"dependencies": {
"define-data-property": "^1.0.1",
"has-property-descriptors": "^1.0.0",
"object-keys": "^1.1.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-property-descriptors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
"license": "MIT",
"dependencies": {
"es-define-property": "^1.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
}
}
}
}
{
"name": "sample-define-properties",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"define-properties": "1.2.1"
}
}
{
"schemaVersion": 1,
"goal": "define properties on object conditionally with predicates and support descriptor flags",
"kind": "HOW",
"packages": [
"pkg:npm/define-properties@1.2.1"
],
"symbols": [
"defineProperties",
"defineProperties.supportsDescriptors"
]
}
import assert from 'node:assert/strict';
import defineProperties from 'define-properties';
// 1. defineProperties defines non-enumerable, writable, configurable properties on target object
{
const target = {};
defineProperties(target, {
a: 1,
b: 'hello',
});
assert.equal(target.a, 1);
assert.equal(target.b, 'hello');
assert.deepEqual(Object.keys(target), []);
const descA = Object.getOwnPropertyDescriptor(target, 'a');
assert.equal(descA.value, 1);
assert.equal(descA.enumerable, false);
assert.equal(descA.writable, true);
assert.equal(descA.configurable, true);
}
// 2. defineProperties preserves existing properties when predicates are not provided or falsy
{
const target = { a: 100, b: 200 };
defineProperties(target, {
a: 1,
b: 2,
c: 3,
});
assert.equal(target.a, 100);
assert.equal(target.b, 200);
assert.equal(target.c, 3);
}
// 3. defineProperties overwrites existing properties when predicate is boolean true and value differs
{
const target = { a: 10, b: 20 };
defineProperties(
target,
{
a: 99,
b: 20,
},
{
a: true,
b: true,
}
);
assert.equal(target.a, 99);
assert.equal(target.b, 20);
}
// 4. defineProperties overwrites existing properties when predicate function returns truthy
{
const target = { a: 1, b: 2 };
defineProperties(
target,
{
a: 10,
b: 20,
},
{
a: () => true,
b: () => 'truthy string',
}
);
assert.equal(target.a, 10);
assert.equal(target.b, 20);
}
// 5. defineProperties does not overwrite existing properties when predicate function returns falsy
{
const target = { a: 1, b: 2 };
let called = false;
defineProperties(
target,
{
a: 10,
b: 20,
},
{
a: () => {
called = true;
return false;
},
b: () => 0,
}
);
assert.equal(called, true);
assert.equal(target.a, 1);
assert.equal(target.b, 2);
}
// 6. defineProperties supports symbol keyed properties on target object
{
const sym = Symbol('foo');
const target = {};
defineProperties(target, {
[sym]: 'bar',
});
assert.equal(target[sym], 'bar');
const descSym = Object.getOwnPropertyDescriptor(target, sym);
assert.equal(descSym.value, 'bar');
assert.equal(descSym.enumerable, false);
}
// 7. defineProperties.supportsDescriptors is a boolean indicating descriptor support
{
assert.equal(typeof defineProperties.supportsDescriptors, 'boolean');
assert.equal(defineProperties.supportsDescriptors, true);
}
Origin Seeder
anonymous