Beispiel
has-symbols 1.1.0: hasNativeSymbols, hasSymbols
Verifiziertes Beispiel für npm has-symbols 1.1.0: hasNativeSymbols, hasSymbols. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:335a6888833cc5b1c69510a9b3f0ad1b28ab0a11f7ad15641e47e61ca669612b
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
windows 11 x64 npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify pkg:npm/has-symbols@1.1.0
- Pakete
- Symbole
-
- hasNativeSymbols
- hasSymbols
- Erstellt
- 2026-08-18T17:57:24Z
Contract
- hasNativeSymbols() returns true in modern JavaScript runtimes with native Symbol support
- hasSymbols() from has-symbols/shams.js returns true when Symbol and Object.getOwnPropertySymbols are supported
- native symbols created with Symbol() produce distinct symbol primitives non-enumerable in Object.keys
- Object.getOwnPropertySymbols retrieves symbol properties assigned to objects
- wrapper functions checkNativeSymbols and checkSymbolsOrShams match direct library calls
Dateien
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Quelltext
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/has-symbols@1.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/has-symbols@1.1.0
Demonstrate these symbols/APIs:
- hasNativeSymbols
- hasSymbols
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:1d7aeeae14d2d313ec4165ca97c8dd9bcd89bbd3e57e64a7f5e1ef19fc8d8e5a","contract":["hasNativeSymbols() returns true in modern JavaScript runtimes with native Symbol support","hasSymbols() from has-symbols/shams.js returns true when Symbol and Object.getOwnPropertySymbols are supported","native symbols created with Symbol() produce distinct symbol primitives non-enumerable in Object.keys","Object.getOwnPropertySymbols retrieves symbol properties assigned to objects","wrapper functions checkNativeSymbols and checkSymbolsOrShams match direct library calls"],"goal":"verify pkg:npm/has-symbols@1.1.0","kind":"HOW","packages":["pkg:npm/has-symbols@1.1.0"],"schemaVersion":1,"symbols":["hasNativeSymbols","hasSymbols"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","ecosystem":"npm","os":"windows","osVersionBucket":"11","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/has-symbols@1.1.0"],"schemaVersion":1,"symbols":["hasNativeSymbols","hasSymbols"],"verifierAdapter":"node-typescript@1"}
import hasNativeSymbols from 'has-symbols';
import hasSymbolsShams from 'has-symbols/shams.js';
/**
* Checks whether the current JavaScript environment has native Symbol support.
* @returns {boolean}
*/
export function checkNativeSymbols() {
return hasNativeSymbols();
}
/**
* Checks whether the current JavaScript environment supports Symbols (either native or shams).
* @returns {boolean}
*/
export function checkSymbolsOrShams() {
return hasSymbolsShams();
}
{
"name": "sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample",
"version": "1.0.0",
"dependencies": {
"has-symbols": "1.1.0"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"license": "MIT",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
}
}
}
{
"name": "sample",
"version": "1.0.0",
"type": "module",
"dependencies": {
"has-symbols": "1.1.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/has-symbols@1.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/has-symbols@1.1.0"
],
"symbols": [
"hasNativeSymbols",
"hasSymbols"
]
}
import assert from 'node:assert/strict';
import hasNativeSymbols from 'has-symbols';
import hasSymbolsShams from 'has-symbols/shams.js';
import { checkNativeSymbols, checkSymbolsOrShams } from '../index.mjs';
// Case 1: hasNativeSymbols returns boolean
{
const result = hasNativeSymbols();
assert.equal(typeof result, 'boolean', 'hasNativeSymbols() must return a boolean');
assert.equal(result, true, 'hasNativeSymbols() should return true in Node.js environment');
}
// Case 2: hasSymbolsShams returns boolean
{
const result = hasSymbolsShams();
assert.equal(typeof result, 'boolean', 'hasSymbolsShams() must return a boolean');
assert.equal(result, true, 'hasSymbolsShams() should return true in Node.js environment');
}
// Case 3: native symbol characteristics validated when supported
{
if (hasNativeSymbols()) {
const sym1 = Symbol('test');
const sym2 = Symbol('test');
assert.equal(typeof sym1, 'symbol', 'typeof Symbol() must be "symbol"');
assert.notEqual(sym1, sym2, 'distinct symbols with same description must not be equal');
assert.equal(typeof Symbol.iterator, 'symbol', 'Symbol.iterator must be a symbol');
}
}
// Case 4: symbol property isolation on objects
{
if (hasSymbolsShams()) {
const symKey = Symbol('contract_key');
const targetObj = { standardKey: 'visible' };
targetObj[symKey] = 'symbol_value';
// Standard reflection ignores symbol keys
assert.deepEqual(Object.keys(targetObj), ['standardKey'], 'Object.keys should exclude symbol keys');
// Symbol reflection retrieves symbol keys
const symbols = Object.getOwnPropertySymbols(targetObj);
assert.equal(symbols.length, 1, 'Object.getOwnPropertySymbols should find 1 symbol key');
assert.equal(symbols[0], symKey, 'retrieved symbol must match assigned symbol');
assert.equal(targetObj[symbols[0]], 'symbol_value', 'value via symbol key must match');
}
}
// Case 5: wrapper functions in index.mjs match direct library exports
{
assert.equal(checkNativeSymbols(), hasNativeSymbols(), 'checkNativeSymbols should match hasNativeSymbols()');
assert.equal(checkSymbolsOrShams(), hasSymbolsShams(), 'checkSymbolsOrShams should match hasSymbolsShams()');
}
console.log('PASS: all has-symbols contract assertions passed');
Ursprungs-Seeder
anonym