CodeSampleX

Beispiel

@jest/get-type 30.1.0: getType

Verifiziertes Beispiel für npm @jest/get-type 30.1.0: getType. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:81bf725f2df5024bdf2d0c6b67f5921e6ba253d8463420a59de6bcf1b148545e

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-05

Fall

HOW
Ziel
verify @jest/get-type.getType in pkg:npm/%40jest/get-type@30.1.0
Pakete
Symbole
  • @jest/get-type.getType
Umgebung
node 22.23.2
Erstellt
2026-09-05T23:53:57Z

Contract

  1. getType identifies JavaScript primitives: undefined, null, boolean, number, string, symbol, and bigint
  2. getType identifies built-in collection and object types: array, map, set, date, and regexp
  3. getType distinguishes plain objects and functions from specialized built-ins

Dateien

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

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 @jest/get-type.getType in pkg:npm/%40jest/get-type@30.1.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40jest/get-type@30.1.0
Demonstrate these symbols/APIs:
  - @jest/get-type.getType

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:36de8895f4a0173af1e3fcc7329f4a21ac5e2601eadde7ed740509b8e9b261c8","contract":["getType identifies JavaScript primitives: undefined, null, boolean, number, string, symbol, and bigint","getType identifies built-in collection and object types: array, map, set, date, and regexp","getType distinguishes plain objects and functions from specialized built-ins"],"goal":"verify @jest/get-type.getType in pkg:npm/%40jest/get-type@30.1.0","kind":"HOW","packages":["pkg:npm/%40jest/get-type@30.1.0"],"schemaVersion":1,"symbols":["@jest/get-type.getType"]},"contractCommand":["node","test/contract.cjs"],"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/%40jest/get-type@30.1.0"],"schemaVersion":1,"subject":"pkg:npm/%40jest/get-type@30.1.0","symbols":["@jest/get-type.getType"],"verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const { getType } = require('@jest/get-type');

function categorizeValue(value) {
  return getType(value);
}

module.exports = {
  getType,
  categorizeValue
};
package-lock.json
{
  "name": "sample-jest-get-type",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-jest-get-type",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@jest/get-type": "30.1.0"
      }
    },
    "node_modules/@jest/get-type": {
      "version": "30.1.0",
      "resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz",
      "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==",
      "license": "MIT",
      "engines": {
        "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
      }
    }
  }
}
package.json
{
  "name": "sample-jest-get-type",
  "version": "1.0.0",
  "private": true,
  "description": "verify @jest/get-type.getType in pkg:npm/%40jest/get-type@30.1.0",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@jest/get-type": "30.1.0"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @jest/get-type.getType in pkg:npm/%40jest/get-type@30.1.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40jest/get-type@30.1.0"
  ],
  "symbols": [
    "@jest/get-type.getType"
  ]
}
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const { getType, categorizeValue } = require('../index.js');
const jestGetType = require('@jest/get-type');

// Verify exported functions
assert.strictEqual(typeof jestGetType.getType, 'function', 'getType must be exported as a function');
assert.strictEqual(typeof getType, 'function', 'getType must be re-exported');
assert.strictEqual(typeof categorizeValue, 'function', 'categorizeValue helper must be a function');

// Assertion 1: getType identifies JavaScript primitives: undefined, null, boolean, number, string, symbol, and bigint
assert.strictEqual(getType(undefined), 'undefined');
assert.strictEqual(getType(null), 'null');
assert.strictEqual(getType(true), 'boolean');
assert.strictEqual(getType(false), 'boolean');
assert.strictEqual(getType(0), 'number');
assert.strictEqual(getType(42), 'number');
assert.strictEqual(getType(-3.14), 'number');
assert.strictEqual(getType(NaN), 'number');
assert.strictEqual(getType(Infinity), 'number');
assert.strictEqual(getType(''), 'string');
assert.strictEqual(getType('hello world'), 'string');
assert.strictEqual(getType(Symbol('sym')), 'symbol');
assert.strictEqual(getType(Symbol.for('key')), 'symbol');
assert.strictEqual(getType(0n), 'bigint');
assert.strictEqual(getType(9007199254740991n), 'bigint');

// Assertion 2: getType identifies built-in collection and object types: array, map, set, date, and regexp
assert.strictEqual(getType([]), 'array');
assert.strictEqual(getType([1, 2, 3]), 'array');
assert.strictEqual(getType(new Array(5)), 'array');
assert.strictEqual(getType(new Map()), 'map');
assert.strictEqual(getType(new Set()), 'set');
assert.strictEqual(getType(new Date()), 'date');
assert.strictEqual(getType(/abc/), 'regexp');
assert.strictEqual(getType(new RegExp('xyz')), 'regexp');

// Assertion 3: getType distinguishes plain objects and functions from specialized built-ins
assert.strictEqual(getType({}), 'object');
assert.strictEqual(getType({ a: 1, b: 'two' }), 'object');
assert.strictEqual(getType(Object.create(null)), 'object');
assert.strictEqual(getType(() => {}), 'function');
assert.strictEqual(getType(function named() {}), 'function');
assert.strictEqual(getType(async () => {}), 'function');

// Helper function validation
assert.strictEqual(categorizeValue('test'), 'string');
assert.strictEqual(categorizeValue([10]), 'array');
assert.strictEqual(categorizeValue({ key: 'value' }), 'object');

console.log('Contract tests passed successfully.');

Ursprungs-Seeder

anonym