CodeSampleX

샘플

fill-range 7.1.1: fill-range

검증된 샘플 — npm fill-range 7.1.1: fill-range. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: fill expands numerical integer ranges in ascending and…

sha256:ae392d5816c600a656fcca041f30719787351a53cb764c7c39c9ed84e30e6590

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

검증 실행 환경

환경 컨트랙트 단계 실행일
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-02

케이스

HOW
목표
verify fill-range in pkg:npm/fill-range@7.1.1
패키지
심벌
  • fill-range
환경
node 22.23.2
생성일
2026-09-02T00:46:46Z

컨트랙트

  1. fill expands numerical integer ranges in ascending and descending order
  2. fill expands numerical ranges with custom step increments
  3. fill expands alphabetical character ranges in ascending and descending order
  4. fill preserves zero-padding format when string inputs have leading zeros
  5. fill transforms output values using a custom transform function
  6. fill converts number ranges to string arrays when stringify option is enabled
  7. fill generates regex range patterns when toRegex option is enabled
  8. fill handles single-argument and invalid range options

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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 fill-range in pkg:npm/fill-range@7.1.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/fill-range@7.1.1
Demonstrate these symbols/APIs:
  - fill-range
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - 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.
csx.json
{"case":{"caseId":"case:sha256:c9bad71e17ac0ad3dcc480b2a4898fb369e9c84a07b66fed3e338791c7854a9b","constraints":{"executionContext":"node"},"contract":["fill expands numerical integer ranges in ascending and descending order","fill expands numerical ranges with custom step increments","fill expands alphabetical character ranges in ascending and descending order","fill preserves zero-padding format when string inputs have leading zeros","fill transforms output values using a custom transform function","fill converts number ranges to string arrays when stringify option is enabled","fill generates regex range patterns when toRegex option is enabled","fill handles single-argument and invalid range options"],"goal":"verify fill-range in pkg:npm/fill-range@7.1.1","kind":"HOW","packages":["pkg:npm/fill-range@7.1.1"],"schemaVersion":1,"symbols":["fill-range"]},"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","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/fill-range@7.1.1"],"schemaVersion":1,"subject":"pkg:npm/fill-range@7.1.1","symbols":["fill-range"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-fill-range",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-fill-range",
      "version": "1.0.0",
      "dependencies": {
        "fill-range": "7.1.1"
      }
    },
    "node_modules/fill-range": {
      "version": "7.1.1",
      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
      "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
      "license": "MIT",
      "dependencies": {
        "to-regex-range": "^5.0.1"
      },
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/is-number": {
      "version": "7.0.0",
      "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
      "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
      "license": "MIT",
      "engines": {
        "node": ">=0.12.0"
      }
    },
    "node_modules/to-regex-range": {
      "version": "5.0.1",
      "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
      "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
      "license": "MIT",
      "dependencies": {
        "is-number": "^7.0.0"
      },
      "engines": {
        "node": ">=8.0"
      }
    }
  }
}
package.json
{
  "name": "sample-fill-range",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "fill-range": "7.1.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify fill-range in pkg:npm/fill-range@7.1.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/fill-range@7.1.1"
  ],
  "symbols": [
    "fill-range"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import fill from 'fill-range';

// 1. fill expands numerical integer ranges in ascending and descending order
{
  assert.deepEqual(fill(1, 5), [1, 2, 3, 4, 5]);
  assert.deepEqual(fill(5, 1), [5, 4, 3, 2, 1]);
  assert.deepEqual(fill(-2, 2), [-2, -1, 0, 1, 2]);
  assert.deepEqual(fill(0, 0), [0]);
}

// 2. fill expands numerical ranges with custom step increments
{
  assert.deepEqual(fill(1, 10, 2), [1, 3, 5, 7, 9]);
  assert.deepEqual(fill(10, 1, 2), [10, 8, 6, 4, 2]);
  assert.deepEqual(fill(1, 10, 3), [1, 4, 7, 10]);
  assert.deepEqual(fill(0, 20, 5), [0, 5, 10, 15, 20]);
}

// 3. fill expands alphabetical character ranges in ascending and descending order
{
  assert.deepEqual(fill('a', 'e'), ['a', 'b', 'c', 'd', 'e']);
  assert.deepEqual(fill('e', 'a'), ['e', 'd', 'c', 'b', 'a']);
  assert.deepEqual(fill('A', 'E', 2), ['A', 'C', 'E']);
  assert.deepEqual(fill('z', 'v', 2), ['z', 'x', 'v']);
}

// 4. fill preserves zero-padding format when string inputs have leading zeros
{
  assert.deepEqual(fill('01', '05'), ['01', '02', '03', '04', '05']);
  assert.deepEqual(fill('001', '005'), ['001', '002', '003', '004', '005']);
  assert.deepEqual(fill('01', '10', 2), ['01', '03', '05', '07', '09']);
  assert.deepEqual(fill('05', '01'), ['05', '04', '03', '02', '01']);
}

// 5. fill transforms output values using a custom transform function
{
  const result1 = fill(1, 3, (val) => String.fromCharCode(val + 64));
  assert.deepEqual(result1, ['A', 'B', 'C']);

  const result2 = fill(1, 3, (val) => val * 10);
  assert.deepEqual(result2, [10, 20, 30]);

  const result3 = fill(1, 3, { transform: (val, index) => `${index}:${val}` });
  assert.deepEqual(result3, ['0:1', '1:2', '2:3']);
}

// 6. fill converts number ranges to string arrays when stringify option is enabled
{
  assert.deepEqual(fill(1, 5, { stringify: true }), ['1', '2', '3', '4', '5']);
  assert.deepEqual(fill(-2, 2, { stringify: true }), ['-2', '-1', '0', '1', '2']);
}

// 7. fill generates regex range patterns when toRegex option is enabled
{
  assert.equal(fill(1, 5, { toRegex: true }), '[1-5]');
  assert.equal(fill('a', 'e', { toRegex: true }), '[a-e]');
  assert.equal(fill(1, 10, 2, { toRegex: true }), '1|3|5|7|9');
  assert.equal(fill('01', '05', { toRegex: true }), '0?[1-5]');
}

// 8. fill handles single-argument and invalid range options
{
  assert.deepEqual(fill(1), [1]);
  assert.deepEqual(fill('a'), ['a']);
  assert.deepEqual(fill(1, 'foo'), []);
  assert.throws(
    () => fill(1, 'foo', { strictRanges: true }),
    /^RangeError: Invalid range arguments:/
  );
  assert.throws(
    () => fill(1, 5, 'invalid_step', { strictRanges: true }),
    /^TypeError: Expected step "invalid_step" to be a number/
  );
}

오리진 시더

익명