CodeSampleX

Beispiel

is-extglob 2.1.1: is-extglob

Verifiziertes Beispiel für npm is-extglob 2.1.1: is-extglob. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand: isExtglob returns true for…

sha256:ed00d6a2c6ade8cfe8a0cb8975ed27144e0e186dd60b588bd160211c56d36b28

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 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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-01

Fall

HOW
Ziel
verify is-extglob in pkg:npm/is-extglob@2.1.1
Pakete
Symbole
  • is-extglob
Umgebung
node 22.23.2
Erstellt
2026-09-01T11:48:43Z

Contract

  1. isExtglob returns true for extended glob patterns containing @, !, ?, *, and + prefix operators
  2. isExtglob returns false for regular file paths and non-extglob standard glob patterns
  3. isExtglob returns false for escaped extglob patterns where the operator is preceded by a backslash
  4. isExtglob returns false when provided non-string values or empty strings
  5. filterExtglobs filters an array of pattern strings and returns only those matching extglob syntax

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Quellartefakt herunterladen (tar.gz)

Quelltext

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 is-extglob in pkg:npm/is-extglob@2.1.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/is-extglob@2.1.1
Demonstrate these symbols/APIs:
  - is-extglob

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:5073e892e53e57b8347023f178d2ad5b17e7a7c0263865be199a26afc87d127f","contract":["isExtglob returns true for extended glob patterns containing @, !, ?, *, and + prefix operators","isExtglob returns false for regular file paths and non-extglob standard glob patterns","isExtglob returns false for escaped extglob patterns where the operator is preceded by a backslash","isExtglob returns false when provided non-string values or empty strings","filterExtglobs filters an array of pattern strings and returns only those matching extglob syntax"],"goal":"verify is-extglob in pkg:npm/is-extglob@2.1.1","kind":"HOW","packages":["pkg:npm/is-extglob@2.1.1"],"schemaVersion":1,"symbols":["is-extglob"]},"contractCommand":["node","test/contract.js"],"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/is-extglob@2.1.1"],"schemaVersion":1,"subject":"pkg:npm/is-extglob@2.1.1","symbols":["is-extglob"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "is-extglob-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "is-extglob-sample",
      "version": "1.0.0",
      "dependencies": {
        "is-extglob": "2.1.1"
      }
    },
    "node_modules/is-extglob": {
      "version": "2.1.1",
      "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
      "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
      "license": "MIT",
      "engines": {
        "node": ">=0.10.0"
      }
    }
  }
}
package.json
{
  "name": "is-extglob-sample",
  "version": "1.0.0",
  "dependencies": {
    "is-extglob": "2.1.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify is-extglob in pkg:npm/is-extglob@2.1.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/is-extglob@2.1.1"
  ],
  "symbols": [
    "is-extglob"
  ]
}
src/index.js
const isExtglob = require('is-extglob');

/**
 * Checks whether a given string contains an extended glob pattern.
 *
 * @param {any} pattern - The pattern or value to test.
 * @returns {boolean} True if the pattern contains an extglob, false otherwise.
 */
function checkIsExtglob(pattern) {
  return isExtglob(pattern);
}

/**
 * Filters a list of pattern strings, returning only those that contain extglobs.
 *
 * @param {string[]} patterns - Array of pattern strings.
 * @returns {string[]} Filtered array of extglob patterns.
 */
function filterExtglobs(patterns) {
  if (!Array.isArray(patterns)) {
    return [];
  }
  return patterns.filter((p) => isExtglob(p));
}

module.exports = {
  isExtglob,
  checkIsExtglob,
  filterExtglobs,
};
test/contract.js
const assert = require('node:assert/strict');
const { isExtglob, checkIsExtglob, filterExtglobs } = require('../src/index.js');

function testExtglobPatterns() {
  // @(pattern) - matches one of the given patterns
  assert.strictEqual(isExtglob('@(a|b)'), true);
  assert.strictEqual(isExtglob('src/@(foo|bar).js'), true);
  assert.strictEqual(checkIsExtglob('@(a|b)'), true);

  // !(pattern) - matches anything except one of the given patterns
  assert.strictEqual(isExtglob('!(a|b)'), true);
  assert.strictEqual(isExtglob('src/!(foo|bar).js'), true);
  assert.strictEqual(checkIsExtglob('!(a|b)'), true);

  // ?(pattern) - matches zero or one occurrence of the given patterns
  assert.strictEqual(isExtglob('?(a|b)'), true);
  assert.strictEqual(isExtglob('src/?(foo|bar).js'), true);
  assert.strictEqual(checkIsExtglob('?(a|b)'), true);

  // *(pattern) - matches zero or more occurrences of the given patterns
  assert.strictEqual(isExtglob('*(a|b)'), true);
  assert.strictEqual(isExtglob('src/*(foo|bar).js'), true);
  assert.strictEqual(checkIsExtglob('*(a|b)'), true);

  // +(pattern) - matches one or more occurrences of the given patterns
  assert.strictEqual(isExtglob('+(a|b)'), true);
  assert.strictEqual(isExtglob('src/+(foo|bar).js'), true);
  assert.strictEqual(checkIsExtglob('+(a|b)'), true);
}

function testNonExtglobPatterns() {
  // Plain paths and file names
  assert.strictEqual(isExtglob('foo.js'), false);
  assert.strictEqual(isExtglob('src/components/button.tsx'), false);
  assert.strictEqual(checkIsExtglob('foo.js'), false);

  // Standard globs (not extglobs)
  assert.strictEqual(isExtglob('*.js'), false);
  assert.strictEqual(isExtglob('**/*.js'), false);
  assert.strictEqual(isExtglob('foo-?.js'), false);
  assert.strictEqual(isExtglob('[a-z].js'), false);
  assert.strictEqual(isExtglob('{a,b}.js'), false);
}

function testEscapedExtglobs() {
  // Escaped extglob prefix should not be treated as extglob
  assert.strictEqual(isExtglob('\\@(a|b)'), false);
  assert.strictEqual(isExtglob('\\!(a|b)'), false);
  assert.strictEqual(isExtglob('\\?(a|b)'), false);
  assert.strictEqual(isExtglob('\\*(a|b)'), false);
  assert.strictEqual(isExtglob('\\+(a|b)'), false);
}

function testInvalidAndNonStringTypes() {
  // Empty string
  assert.strictEqual(isExtglob(''), false);

  // Non-string types
  assert.strictEqual(isExtglob(null), false);
  assert.strictEqual(isExtglob(undefined), false);
  assert.strictEqual(isExtglob(123), false);
  assert.strictEqual(isExtglob(true), false);
  assert.strictEqual(isExtglob(false), false);
  assert.strictEqual(isExtglob({}), false);
  assert.strictEqual(isExtglob([]), false);
  assert.strictEqual(isExtglob(Symbol('glob')), false);
}

function testFilterExtglobs() {
  const list = ['foo.js', '@(a|b)', '*.js', '!(x|y)', 'bar/baz.ts'];
  const filtered = filterExtglobs(list);
  assert.deepStrictEqual(filtered, ['@(a|b)', '!(x|y)']);

  assert.deepStrictEqual(filterExtglobs(null), []);
  assert.deepStrictEqual(filterExtglobs(undefined), []);
}

function main() {
  testExtglobPatterns();
  testNonExtglobPatterns();
  testEscapedExtglobs();
  testInvalidAndNonStringTypes();
  testFilterExtglobs();

  console.log('All pkg:npm/is-extglob@2.1.1 contracts passed successfully.');
}

main();

Ursprungs-Seeder

anonym