Beispiel
micromatch 4.0.8: isMatch
Verifiziertes Beispiel für npm micromatch 4.0.8: isMatch. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:d0be790ad26248957db4fad67d9582d9728874831be5183055930826246456f2
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 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-28 |
Fall
HOW- Ziel
- verify micromatch.isMatch in pkg:npm/micromatch@4.0.8
- Pakete
- Symbole
-
- micromatch.isMatch
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-28T02:45:58Z
Contract
- micromatch.isMatch is exported as a function on the micromatch module
- micromatch.isMatch matches a string against a glob pattern and returns boolean
- micromatch.isMatch evaluates single negation pattern returning false for negated target
- micromatch.isMatch matches nested path hierarchies using globstar wildcards
- micromatch.isMatch supports nocase option for case-insensitive glob matching
- micromatch.isMatch supports ignore option to exclude specified patterns
- micromatch.isMatch matches dotfiles only when dot option is enabled
- micromatch.isMatch matches against basename when basename option is enabled
- micromatch.isMatch throws TypeError when string argument is null or undefined
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 micromatch.isMatch in pkg:npm/micromatch@4.0.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/micromatch@4.0.8
Demonstrate these symbols/APIs:
- micromatch.isMatch
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.
{"case":{"caseId":"case:sha256:031ac0d1c8b81a604279845705880d1b3c5dcdced005444a7365f589d7c4daad","constraints":{"executionContext":"node"},"contract":["micromatch.isMatch is exported as a function on the micromatch module","micromatch.isMatch matches a string against a glob pattern and returns boolean","micromatch.isMatch evaluates single negation pattern returning false for negated target","micromatch.isMatch matches nested path hierarchies using globstar wildcards","micromatch.isMatch supports nocase option for case-insensitive glob matching","micromatch.isMatch supports ignore option to exclude specified patterns","micromatch.isMatch matches dotfiles only when dot option is enabled","micromatch.isMatch matches against basename when basename option is enabled","micromatch.isMatch throws TypeError when string argument is null or undefined"],"goal":"verify micromatch.isMatch in pkg:npm/micromatch@4.0.8","kind":"HOW","packages":["pkg:npm/micromatch@4.0.8"],"schemaVersion":1,"symbols":["micromatch.isMatch"]},"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/micromatch@4.0.8"],"schemaVersion":1,"subject":"pkg:npm/micromatch@4.0.8","symbols":["micromatch.isMatch"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-micromatch-ismatch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-micromatch-ismatch",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"micromatch": "4.0.8"
}
},
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"license": "MIT",
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"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/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"license": "MIT",
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=8.6"
}
},
"node_modules/picomatch": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"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"
}
}
}
}
{
"name": "sample-micromatch-ismatch",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of micromatch.isMatch in micromatch@4.0.8",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"micromatch": "4.0.8"
}
}
{
"schemaVersion": 1,
"goal": "verify micromatch.isMatch in pkg:npm/micromatch@4.0.8",
"kind": "HOW",
"packages": [
"pkg:npm/micromatch@4.0.8"
],
"symbols": [
"micromatch.isMatch"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const micromatch = require('micromatch');
/**
* Check if a file path matches given glob patterns.
*
* @param {string} filepath - File path to test
* @param {string|string[]} patterns - Glob pattern or array of patterns
* @param {object} [options] - Micromatch options
* @returns {boolean} True if string matches pattern
*/
function isMatch(filepath, patterns, options) {
return micromatch.isMatch(filepath, patterns, options);
}
/**
* Match a file path against a pattern ignoring file case.
*
* @param {string} filepath - File path to test
* @param {string|string[]} patterns - Glob pattern(s)
* @returns {boolean} True if matches case-insensitively
*/
function isMatchCaseInsensitive(filepath, patterns) {
return micromatch.isMatch(filepath, patterns, { nocase: true });
}
/**
* Match filename only regardless of directory path.
*
* @param {string} filepath - Full or relative file path
* @param {string|string[]} pattern - Pattern to match against filename
* @returns {boolean} True if basename matches
*/
function isBasenameMatch(filepath, pattern) {
return micromatch.isMatch(filepath, pattern, { basename: true });
}
/**
* Match dotfiles/hidden files.
*
* @param {string} filepath - File path to test
* @param {string|string[]} pattern - Glob pattern
* @returns {boolean} True if dotfile matches
*/
function isDotfileMatch(filepath, pattern) {
return micromatch.isMatch(filepath, pattern, { dot: true });
}
module.exports = {
micromatch,
isMatch: micromatch.isMatch,
matchHelper: isMatch,
isMatchCaseInsensitive,
isBasenameMatch,
isDotfileMatch
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
micromatch,
isMatch,
matchHelper,
isMatchCaseInsensitive,
isBasenameMatch,
isDotfileMatch
} = require('../src/index.js');
// 1. micromatch.isMatch is exported as a function on the micromatch module
assert.equal(typeof micromatch, 'function', 'micromatch must be a function');
assert.equal(typeof micromatch.isMatch, 'function', 'micromatch.isMatch must be a function');
assert.equal(typeof isMatch, 'function', 'isMatch must be a function');
assert.equal(typeof matchHelper, 'function', 'matchHelper must be a function');
assert.equal(typeof isMatchCaseInsensitive, 'function', 'isMatchCaseInsensitive must be a function');
assert.equal(typeof isBasenameMatch, 'function', 'isBasenameMatch must be a function');
assert.equal(typeof isDotfileMatch, 'function', 'isDotfileMatch must be a function');
assert.equal(isMatch, micromatch.isMatch, 'isMatch should reference micromatch.isMatch');
// 2. micromatch.isMatch matches a string against a glob pattern and returns boolean
assert.equal(micromatch.isMatch('foo.js', '*.js'), true, 'foo.js should match *.js');
assert.equal(micromatch.isMatch('foo.txt', '*.js'), false, 'foo.txt should not match *.js');
assert.equal(matchHelper('foo.js', '*.js'), true, 'matchHelper should match foo.js');
assert.equal(micromatch.isMatch('file.ts', ['*.js', '*.ts']), true, 'file.ts should match pattern array');
// 3. micromatch.isMatch evaluates single negation pattern returning false for negated target
assert.equal(micromatch.isMatch('bar.js', '!foo.js'), true, 'bar.js should match negation of foo.js');
assert.equal(micromatch.isMatch('foo.js', '!foo.js'), false, 'foo.js should not match negation of foo.js');
assert.equal(micromatch.isMatch('foo.js', '!*.js'), false, 'foo.js should not match negation of *.js');
// 4. micromatch.isMatch matches nested path hierarchies using globstar wildcards
assert.equal(micromatch.isMatch('src/components/Button.jsx', 'src/**/*.jsx'), true, 'nested path should match globstar');
assert.equal(micromatch.isMatch('src/components/Button.jsx', 'src/*.jsx'), false, 'nested path should not match single star');
// 5. micromatch.isMatch supports nocase option for case-insensitive glob matching
assert.equal(micromatch.isMatch('README.MD', '*.md', { nocase: true }), true, 'README.MD should match *.md with nocase');
assert.equal(micromatch.isMatch('README.MD', '*.md'), false, 'README.MD should not match *.md without nocase');
assert.equal(isMatchCaseInsensitive('STYLE.CSS', '*.css'), true, 'isMatchCaseInsensitive helper should match STYLE.CSS');
// 6. micromatch.isMatch supports ignore option to exclude specified patterns
assert.equal(
micromatch.isMatch('src/dist/bundle.js', 'src/**/*.js', { ignore: ['**/dist/**'] }),
false,
'path inside ignored directory should return false'
);
assert.equal(
micromatch.isMatch('src/app/index.js', 'src/**/*.js', { ignore: ['**/dist/**'] }),
true,
'path outside ignored directory should return true'
);
// 7. micromatch.isMatch matches dotfiles only when dot option is enabled
assert.equal(micromatch.isMatch('.env', '*'), false, '.env should not match * without dot:true');
assert.equal(micromatch.isMatch('.env', '*', { dot: true }), true, '.env should match * with dot:true');
assert.equal(isDotfileMatch('.gitignore', '*'), true, 'isDotfileMatch helper should match dotfile');
// 8. micromatch.isMatch matches against basename when basename option is enabled
assert.equal(micromatch.isMatch('a/b/c/foo.js', '*.js'), false, 'a/b/c/foo.js should not match *.js without basename');
assert.equal(micromatch.isMatch('a/b/c/foo.js', '*.js', { basename: true }), true, 'a/b/c/foo.js should match *.js with basename:true');
assert.equal(isBasenameMatch('nested/deep/path/app.js', '*.js'), true, 'isBasenameMatch helper should match basename');
// 9. micromatch.isMatch throws TypeError when string argument is null or undefined
assert.throws(
() => micromatch.isMatch(null, '*.js'),
{
name: 'TypeError'
},
'micromatch.isMatch should throw TypeError when string is null'
);
assert.throws(
() => micromatch.isMatch(undefined, '*.js'),
{
name: 'TypeError'
},
'micromatch.isMatch should throw TypeError when string is undefined'
);
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym