Пример
regenerate 1.4.2: create regular expression character classes from code points and ranges with regenerate
Проверенный пример — npm regenerate 1.4.2: create regular expression character classes from code points and ranges with regenerate. Контракт выполнен на node…
sha256:e252dc0549d10fccbb994d6131997e90fc4c83c26c7c0f2c21880a6497451ce8
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux 24 · ubuntu · glibc 2.39 x64 npm
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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 |
Кейс
HOW- Цель
- create regular expression character classes from code points and ranges with regenerate
- Пакеты
- Символы
-
- regenerate
- regenerate.prototype.add
- regenerate.prototype.addRange
- regenerate.prototype.toRegExp
- regenerate.prototype.toString
- Создан
- 2026-08-27T20:47:08Z
Контракт
- regenerate initializes a set and accepts variable arguments of characters or code points
- regenerate.prototype.add adds code points, character strings, and numbers to the character set
- regenerate.prototype.addRange adds contiguous ranges of unicode code points
- regenerate.prototype.toString serializes the character set into an optimized regular expression character class pattern
- regenerate.prototype.toRegExp compiles the set into a RegExp instance with optional flags to match target strings
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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: create regular expression character classes from code points and ranges with regenerate
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/regenerate@1.4.2
Demonstrate these symbols/APIs:
- regenerate
- regenerate.prototype.add
- regenerate.prototype.addRange
- regenerate.prototype.toRegExp
- regenerate.prototype.toString
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:1ea1cde88ae058444312dc227b02b90b580d48ee71f00b6887c2df062bb44655","contract":["regenerate initializes a set and accepts variable arguments of characters or code points","regenerate.prototype.add adds code points, character strings, and numbers to the character set","regenerate.prototype.addRange adds contiguous ranges of unicode code points","regenerate.prototype.toString serializes the character set into an optimized regular expression character class pattern","regenerate.prototype.toRegExp compiles the set into a RegExp instance with optional flags to match target strings"],"goal":"create regular expression character classes from code points and ranges with regenerate","kind":"HOW","packages":["pkg:npm/regenerate@1.4.2"],"schemaVersion":1,"symbols":["regenerate","regenerate.prototype.add","regenerate.prototype.addRange","regenerate.prototype.toRegExp","regenerate.prototype.toString"]},"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/regenerate@1.4.2"],"schemaVersion":1,"subject":"pkg:npm/regenerate@1.4.2","symbols":["regenerate","regenerate.prototype.add","regenerate.prototype.addRange","regenerate.prototype.toRegExp","regenerate.prototype.toString"],"verifierAdapter":"node-typescript@1"}
{
"name": "regenerate-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "regenerate-sample",
"version": "1.0.0",
"dependencies": {
"regenerate": "1.4.2"
}
},
"node_modules/regenerate": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
"integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==",
"license": "MIT"
}
}
}
{
"name": "regenerate-sample",
"version": "1.0.0",
"private": true,
"type": "module",
"description": "Clean-room verification for regenerate",
"dependencies": {
"regenerate": "1.4.2"
}
}
{
"schemaVersion": 1,
"goal": "create regular expression character classes from code points and ranges with regenerate",
"kind": "HOW",
"packages": [
"pkg:npm/regenerate@1.4.2"
],
"symbols": [
"regenerate",
"regenerate.prototype.add",
"regenerate.prototype.addRange",
"regenerate.prototype.toRegExp",
"regenerate.prototype.toString"
]
}
import assert from 'node:assert';
import regenerate from 'regenerate';
// 1. regenerate initializes a set and accepts variable arguments of characters or code points
const set1 = regenerate(0x61, 'b');
assert.strictEqual(typeof set1.add, 'function');
assert.strictEqual(typeof set1.addRange, 'function');
assert.strictEqual(typeof set1.toString, 'function');
assert.strictEqual(typeof set1.toRegExp, 'function');
assert.strictEqual(set1.contains(0x61), true);
assert.strictEqual(set1.contains(0x62), true);
assert.strictEqual(set1.contains(0x63), false);
// 2. regenerate.prototype.add adds code points, character strings, and numbers to the character set
const set2 = regenerate().add('x', 0x79, 'z');
assert.strictEqual(set2.contains(0x78), true);
assert.strictEqual(set2.contains(0x79), true);
assert.strictEqual(set2.contains(0x7A), true);
assert.strictEqual(set2.contains(0x61), false);
// 3. regenerate.prototype.addRange adds contiguous ranges of unicode code points
const set3 = regenerate().addRange(0x30, 0x39).addRange(0x41, 0x46);
assert.strictEqual(set3.contains(0x30), true);
assert.strictEqual(set3.contains(0x35), true);
assert.strictEqual(set3.contains(0x39), true);
assert.strictEqual(set3.contains(0x41), true);
assert.strictEqual(set3.contains(0x46), true);
assert.strictEqual(set3.contains(0x47), false);
// 4. regenerate.prototype.toString serializes the character set into an optimized regular expression character class pattern
const set4 = regenerate().addRange(0x30, 0x39).add('a', 'b', 'c');
assert.strictEqual(set4.toString(), '[0-9a-c]');
const set4Solo = regenerate('a');
assert.strictEqual(set4Solo.toString(), 'a');
// 5. regenerate.prototype.toRegExp compiles the set into a RegExp instance with optional flags to match target strings
const set5 = regenerate().addRange(0x30, 0x39).add('a');
const re = set5.toRegExp('i');
assert.ok(re instanceof RegExp);
assert.strictEqual(re.flags, 'i');
assert.strictEqual(re.test('5'), true);
assert.strictEqual(re.test('a'), true);
assert.strictEqual(re.test('A'), true);
assert.strictEqual(re.test('z'), false);
console.log('Contract passed');
Исходный сидер
аноним