サンプル
range-parser 1.3.0
検証済みサンプル — npm range-parser 1.3.0. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: parseRange(size, str) parses single byte range and sets type…
sha256:9c2b35d0b230f67252f5da82f536bf8f472e2b46a0c7f0b5d41f69701e26b7e2
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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@1 |
2026-08-20 |
ケース
HOW- ゴール
- verify pkg:npm/range-parser@1.3.0
- パッケージ
- 作成日
- 2026-08-20T13:59:10Z
コントラクト
- parseRange(size, str) parses single byte range and sets type property to 'bytes'
- parseRange(size, str) parses multiple non-overlapping ranges
- parseRange(size, str) parses suffix range relative to total size
- parseRange(size, str) parses open-ended range to end of size
- parseRange(size, str) caps range ending at total size minus one
- parseRange(size, str, { combine: true }) combines overlapping and adjacent ranges
- parseRange(size, str) returns -1 for unsatisfiable ranges
- parseRange(size, str) returns -2 for invalid or malformed range 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: verify pkg:npm/range-parser@1.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/range-parser@1.3.0
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:327c2b138eac6d2433694491a6241a56ec89684c2cd2088860f6bedd7a1a8fb8","contract":["parseRange(size, str) parses single byte range and sets type property to 'bytes'","parseRange(size, str) parses multiple non-overlapping ranges","parseRange(size, str) parses suffix range relative to total size","parseRange(size, str) parses open-ended range to end of size","parseRange(size, str) caps range ending at total size minus one","parseRange(size, str, { combine: true }) combines overlapping and adjacent ranges","parseRange(size, str) returns -1 for unsatisfiable ranges","parseRange(size, str) returns -2 for invalid or malformed range strings"],"goal":"verify pkg:npm/range-parser@1.3.0","kind":"HOW","packages":["pkg:npm/range-parser@1.3.0"],"schemaVersion":1},"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/range-parser@1.3.0"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "sample-range-parser",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-range-parser",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"range-parser": "1.3.0"
}
},
"node_modules/range-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz",
"integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
}
}
}
{
"name": "sample-range-parser",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"range-parser": "1.3.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/range-parser@1.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/range-parser@1.3.0"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const parseRange = require('range-parser');
// 1. Function export verification
assert.equal(typeof parseRange, 'function', 'parseRange must be a function');
// 2. parseRange(size, str) parses single byte range and sets type property to 'bytes'
const single = parseRange(1000, 'bytes=0-499');
assert.equal(single.type, 'bytes');
assert.equal(single.length, 1);
assert.deepEqual(single[0], { start: 0, end: 499 });
// 3. parseRange(size, str) parses multiple non-overlapping ranges
const multiple = parseRange(1000, 'bytes=0-100, 200-300');
assert.equal(multiple.type, 'bytes');
assert.equal(multiple.length, 2);
assert.deepEqual(multiple[0], { start: 0, end: 100 });
assert.deepEqual(multiple[1], { start: 200, end: 300 });
// 4. parseRange(size, str) parses suffix range relative to total size
const suffix = parseRange(1000, 'bytes=-100');
assert.equal(suffix.type, 'bytes');
assert.equal(suffix.length, 1);
assert.deepEqual(suffix[0], { start: 900, end: 999 });
// 5. parseRange(size, str) parses open-ended range to end of size
const openEnded = parseRange(1000, 'bytes=500-');
assert.equal(openEnded.type, 'bytes');
assert.equal(openEnded.length, 1);
assert.deepEqual(openEnded[0], { start: 500, end: 999 });
// 6. parseRange(size, str) caps range ending at total size minus one
const capped = parseRange(1000, 'bytes=0-2000');
assert.equal(capped.type, 'bytes');
assert.equal(capped.length, 1);
assert.deepEqual(capped[0], { start: 0, end: 999 });
// 7. parseRange(size, str, { combine: true }) combines overlapping and adjacent ranges
const combined = parseRange(1000, 'bytes=0-100, 50-150', { combine: true });
assert.equal(combined.type, 'bytes');
assert.equal(combined.length, 1);
assert.deepEqual(combined[0], { start: 0, end: 150 });
// 8. parseRange(size, str) returns -1 for unsatisfiable ranges
assert.equal(parseRange(1000, 'bytes=1000-2000'), -1);
assert.equal(parseRange(1000, 'bytes=500-400'), -1);
// 9. parseRange(size, str) returns -2 for invalid or malformed range strings
assert.equal(parseRange(1000, 'invalid'), -2);
assert.equal(parseRange(1000, 'bytes='), -2);
assert.equal(parseRange(1000, 'bytes=-'), -2);
assert.equal(parseRange(1000, 'bytes=abc-def'), -2);
オリジンシーダー
匿名