Beispiel
@babel/helper-validator-identifier 8.0.4: isStrictReservedWord
Verifiziertes Beispiel für npm @babel/helper-validator-identifier 8.0.4: isStrictReservedWord. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und…
sha256:37e494367f9ba43e1bf1a5e5a121077c4725ab6e01ef9c9d141882390ab25833
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
- 2
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
| 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 |
Fall
HOW- Ziel
- verify @babel/helper-validator-identifier.isStrictReservedWord in pkg:npm/%40babel/helper-validator-identifier@8.0.4
- Symbole
-
- @babel/helper-validator-identifier.isStrictReservedWord
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-20T21:17:27Z
Contract
- isStrictReservedWord returns true for strict mode reserved words (implements, interface, let, package, private, protected, public, static, yield)
- isStrictReservedWord returns true for enum in both module and script contexts
- isStrictReservedWord returns true for await when inModule is true
- isStrictReservedWord returns false for await when inModule is false or omitted
- isStrictReservedWord returns false for standard keywords, regular identifiers, and casing variations
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 @babel/helper-validator-identifier.isStrictReservedWord in pkg:npm/%40babel/helper-validator-identifier@8.0.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40babel/helper-validator-identifier@8.0.4
Demonstrate these symbols/APIs:
- @babel/helper-validator-identifier.isStrictReservedWord
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- runtime: node@22.23.2
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:87b75ddc8f732b3795c462064658775932c012a5e55de70320f4d2f3f97ca028","constraints":{"executionContext":"node"},"contract":["isStrictReservedWord returns true for strict mode reserved words (implements, interface, let, package, private, protected, public, static, yield)","isStrictReservedWord returns true for enum in both module and script contexts","isStrictReservedWord returns true for await when inModule is true","isStrictReservedWord returns false for await when inModule is false or omitted","isStrictReservedWord returns false for standard keywords, regular identifiers, and casing variations"],"goal":"verify @babel/helper-validator-identifier.isStrictReservedWord in pkg:npm/%40babel/helper-validator-identifier@8.0.4","kind":"HOW","packages":["pkg:npm/%40babel/helper-validator-identifier@8.0.4"],"schemaVersion":1,"symbols":["@babel/helper-validator-identifier.isStrictReservedWord"]},"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","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40babel/helper-validator-identifier@8.0.4"],"schemaVersion":1,"subject":"pkg:npm/%40babel/helper-validator-identifier@8.0.4","symbols":["@babel/helper-validator-identifier.isStrictReservedWord"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-babel-helper-validator-identifier",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-babel-helper-validator-identifier",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@babel/helper-validator-identifier": "8.0.4"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-8.0.4.tgz",
"integrity": "sha512-4wFaiLd0bVo4cIoTXI3zKI038NIWE/cr3jvBjejOVYVxV/m8Ltav1USiGzG1fmS5J2RhgEOgXNNK46cRPnRsrg==",
"license": "MIT",
"engines": {
"node": "^22.18.0 || >=24.11.0"
}
}
}
}
{
"name": "sample-babel-helper-validator-identifier",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of @babel/helper-validator-identifier.isStrictReservedWord",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"@babel/helper-validator-identifier": "8.0.4"
}
}
{
"schemaVersion": 1,
"goal": "verify @babel/helper-validator-identifier.isStrictReservedWord in pkg:npm/%40babel/helper-validator-identifier@8.0.4",
"kind": "HOW",
"packages": [
"pkg:npm/%40babel/helper-validator-identifier@8.0.4"
],
"symbols": [
"@babel/helper-validator-identifier.isStrictReservedWord"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"runtime": "node@22.23.2"
}
}
const { isStrictReservedWord } = require('@babel/helper-validator-identifier');
/**
* Checks whether a given word is a strict reserved word in the specified module context.
* @param {string} word - The identifier string to check.
* @param {boolean} [inModule=false] - Whether the context is inside an ES module.
* @returns {boolean} True if the word is a strict reserved word.
*/
function checkIsStrictReservedWord(word, inModule = false) {
return isStrictReservedWord(word, inModule);
}
/**
* Filters a list of words and returns only those that are strict reserved words.
* @param {string[]} words - Array of words to check.
* @param {boolean} [inModule=false] - Whether the context is inside an ES module.
* @returns {string[]} Array containing only strict reserved words.
*/
function filterStrictReservedWords(words, inModule = false) {
if (!Array.isArray(words)) {
return [];
}
return words.filter((word) => typeof word === 'string' && isStrictReservedWord(word, inModule));
}
module.exports = {
checkIsStrictReservedWord,
filterStrictReservedWords,
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { checkIsStrictReservedWord, filterStrictReservedWords } = require('../src/index.js');
const { isStrictReservedWord } = require('@babel/helper-validator-identifier');
async function runContract() {
// 1. isStrictReservedWord returns true for strict mode reserved words (implements, interface, let, package, private, protected, public, static, yield)
const strictReservedWords = [
'implements',
'interface',
'let',
'package',
'private',
'protected',
'public',
'static',
'yield',
];
for (const word of strictReservedWords) {
assert.strictEqual(isStrictReservedWord(word, true), true, `expected isStrictReservedWord("${word}", true) to be true`);
assert.strictEqual(isStrictReservedWord(word, false), true, `expected isStrictReservedWord("${word}", false) to be true`);
assert.strictEqual(isStrictReservedWord(word), true, `expected isStrictReservedWord("${word}") to be true`);
assert.strictEqual(checkIsStrictReservedWord(word, true), true, `expected checkIsStrictReservedWord("${word}", true) to be true`);
assert.strictEqual(checkIsStrictReservedWord(word, false), true, `expected checkIsStrictReservedWord("${word}", false) to be true`);
assert.strictEqual(checkIsStrictReservedWord(word), true, `expected checkIsStrictReservedWord("${word}") to be true`);
}
// 2. isStrictReservedWord returns true for enum in both module and script contexts
assert.strictEqual(isStrictReservedWord('enum', true), true, 'expected isStrictReservedWord("enum", true) to be true');
assert.strictEqual(isStrictReservedWord('enum', false), true, 'expected isStrictReservedWord("enum", false) to be true');
assert.strictEqual(isStrictReservedWord('enum'), true, 'expected isStrictReservedWord("enum") to be true');
assert.strictEqual(checkIsStrictReservedWord('enum', true), true, 'expected checkIsStrictReservedWord("enum", true) to be true');
assert.strictEqual(checkIsStrictReservedWord('enum', false), true, 'expected checkIsStrictReservedWord("enum", false) to be true');
assert.strictEqual(checkIsStrictReservedWord('enum'), true, 'expected checkIsStrictReservedWord("enum") to be true');
// 3. isStrictReservedWord returns true for await when inModule is true
assert.strictEqual(isStrictReservedWord('await', true), true, 'expected isStrictReservedWord("await", true) to be true');
assert.strictEqual(checkIsStrictReservedWord('await', true), true, 'expected checkIsStrictReservedWord("await", true) to be true');
// 4. isStrictReservedWord returns false for await when inModule is false or omitted
assert.strictEqual(Boolean(isStrictReservedWord('await', false)), false, 'expected isStrictReservedWord("await", false) to be false');
assert.strictEqual(Boolean(isStrictReservedWord('await')), false, 'expected isStrictReservedWord("await") to be false');
assert.strictEqual(Boolean(checkIsStrictReservedWord('await', false)), false, 'expected checkIsStrictReservedWord("await", false) to be false');
assert.strictEqual(Boolean(checkIsStrictReservedWord('await')), false, 'expected checkIsStrictReservedWord("await") to be false');
// 5. isStrictReservedWord returns false for standard keywords, regular identifiers, and casing variations
const nonStrictReservedWords = [
'if',
'else',
'for',
'while',
'function',
'return',
'var',
'const',
'class',
'import',
'export',
'foo',
'bar',
'myIdentifier',
'LET',
'Let',
'IMPLEMENTS',
'Implements',
'ENUM',
'Enum',
'AWAIT',
'Await',
];
for (const word of nonStrictReservedWords) {
assert.strictEqual(Boolean(isStrictReservedWord(word, true)), false, `expected isStrictReservedWord("${word}", true) to be false`);
assert.strictEqual(Boolean(isStrictReservedWord(word, false)), false, `expected isStrictReservedWord("${word}", false) to be false`);
assert.strictEqual(Boolean(checkIsStrictReservedWord(word, true)), false, `expected checkIsStrictReservedWord("${word}", true) to be false`);
assert.strictEqual(Boolean(checkIsStrictReservedWord(word, false)), false, `expected checkIsStrictReservedWord("${word}", false) to be false`);
}
// Helper validation: filterStrictReservedWords
const testList = ['foo', 'let', 'bar', 'await', 'implements', 'if', 'enum', 'static'];
const filteredModule = filterStrictReservedWords(testList, true);
assert.deepStrictEqual(filteredModule, ['let', 'await', 'implements', 'enum', 'static']);
const filteredScript = filterStrictReservedWords(testList, false);
assert.deepStrictEqual(filteredScript, ['let', 'implements', 'enum', 'static']);
assert.deepStrictEqual(filterStrictReservedWords([]), []);
assert.deepStrictEqual(filterStrictReservedWords(null), []);
console.log('Contract tests passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Ursprungs-Seeder
anonym