Sample
hasown 2.0.4: hasOwn
Verified sample for npm hasown 2.0.4: hasOwn. The contract ran on node 22 · linux alpine/x64 · docker and passed: hasOwn returns true for direct own…
sha256:c886ab294bb3afe864b94927cf821cc736b627449a5bc3a9ae3c326afa5e51dd
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
node 22 linux x64 node 22 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-19 |
Case
HOW- Goal
- verify pkg:npm/hasown@2.0.4
- Packages
- Symbols
-
- hasOwn
- Environment
- node 22
- Created
- 2026-08-18T17:58:24Z
Contract
- hasOwn returns true for direct own properties on plain objects including undefined and null values
- hasOwn returns false for inherited prototype properties like toString and valueOf
- hasOwn returns true for valid array indices and length property while returning false for out of bounds indices and array prototype methods
- hasOwn works correctly on objects created with Object.create(null) lacking Object prototype methods
- hasOwn correctly identifies properties on objects where hasOwnProperty is shadowed or overridden
- hasOwn returns true for properties with falsy values such as false, empty string, and zero
- hasOwn supports Symbol properties when Symbol is available in the environment
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
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: verify pkg:npm/hasown@2.0.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/hasown@2.0.4
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@11.8.0
- runtime: node@24.13.1
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:e872aa68f1629b728f550338c4935085a16e4c372bc9d43b5b985d89f7e22b95","constraints":{"executionContext":"node"},"contract":["hasOwn returns true for direct own properties on plain objects including undefined and null values","hasOwn returns false for inherited prototype properties like toString and valueOf","hasOwn returns true for valid array indices and length property while returning false for out of bounds indices and array prototype methods","hasOwn works correctly on objects created with Object.create(null) lacking Object prototype methods","hasOwn correctly identifies properties on objects where hasOwnProperty is shadowed or overridden","hasOwn returns true for properties with falsy values such as false, empty string, and zero","hasOwn supports Symbol properties when Symbol is available in the environment"],"goal":"verify pkg:npm/hasown@2.0.4","kind":"HOW","packages":["pkg:npm/hasown@2.0.4"],"schemaVersion":1,"symbols":["hasOwn"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","ecosystem":"npm","executionContext":"node","language":"javascript","moduleSystem":"cjs","os":"linux","packageManager":"npm","packageManagerVersion":"10","runtime":"node","runtimeVersion":"22","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/hasown@2.0.4"],"schemaVersion":1,"symbols":["hasOwn"],"verifierAdapter":"node-typescript@1"}
'use strict';
var hasOwn = require('hasown');
function checkProperty(object, property) {
return hasOwn(object, property);
}
module.exports = {
hasOwn: hasOwn,
checkProperty: checkProperty
};
{
"name": "sample-hasown",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-hasown",
"version": "1.0.0",
"dependencies": {
"hasown": "2.0.4"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
}
}
}
{
"name": "sample-hasown",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of hasown package",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"hasown": "2.0.4"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/hasown@2.0.4",
"kind": "HOW",
"packages": [
"pkg:npm/hasown@2.0.4"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@11.8.0",
"runtime": "node@24.13.1"
}
}
'use strict';
var assert = require('assert');
var sample = require('../index.js');
var hasOwn = sample.hasOwn;
// 1. Direct own properties on plain objects
var obj = { a: 1, b: undefined, nullProp: null };
assert.strictEqual(hasOwn(obj, 'a'), true);
assert.strictEqual(hasOwn(obj, 'b'), true);
assert.strictEqual(hasOwn(obj, 'nullProp'), true);
assert.strictEqual(hasOwn(obj, 'c'), false);
// 2. Inherited properties return false
assert.strictEqual(hasOwn(obj, 'toString'), false);
assert.strictEqual(hasOwn(obj, 'valueOf'), false);
assert.strictEqual(hasOwn(obj, 'hasOwnProperty'), false);
// 3. Array indices and length property
var arr = [10, 20, 30];
assert.strictEqual(hasOwn(arr, 0), true);
assert.strictEqual(hasOwn(arr, '0'), true);
assert.strictEqual(hasOwn(arr, 2), true);
assert.strictEqual(hasOwn(arr, 3), false);
assert.strictEqual(hasOwn(arr, 'length'), true);
assert.strictEqual(hasOwn(arr, 'map'), false);
// 4. Objects created with Object.create(null) (no prototype)
var nullProtoObj = Object.create(null);
nullProtoObj.key = 'value';
assert.strictEqual(hasOwn(nullProtoObj, 'key'), true);
assert.strictEqual(hasOwn(nullProtoObj, 'missing'), false);
// 5. Objects with shadowed / overridden hasOwnProperty
var shadowed = {
hasOwnProperty: function () {
return false;
},
foo: 'bar'
};
assert.strictEqual(hasOwn(shadowed, 'foo'), true);
assert.strictEqual(hasOwn(shadowed, 'hasOwnProperty'), true);
assert.strictEqual(hasOwn(shadowed, 'nonexistent'), false);
// 6. Object with property having falsy or boolean values
var boolObj = { flag: false, empty: '', zero: 0 };
assert.strictEqual(hasOwn(boolObj, 'flag'), true);
assert.strictEqual(hasOwn(boolObj, 'empty'), true);
assert.strictEqual(hasOwn(boolObj, 'zero'), true);
// 7. Symbol properties
if (typeof Symbol === 'function') {
var sym = Symbol('test');
var symObj = {};
symObj[sym] = 42;
assert.strictEqual(hasOwn(symObj, sym), true);
}
// 8. Custom wrapper checkProperty
assert.strictEqual(sample.checkProperty(obj, 'a'), true);
assert.strictEqual(sample.checkProperty(obj, 'missing'), false);
console.log('PASS: hasown contract verified');
Origin Seeder
anonymous