Exemple
jest-get-type 29.6.3: getType
Échantillon vérifié pour npm jest-get-type 29.6.3: getType. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:873c5e9eaf2c8ce27c394621a7f596347994fe6cfc882a8da5630150c9e9d5cc
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
Cas
HOW- Objectif
- verify pkg:npm/jest-get-type@29.6.3
- Paquets
- Symboles
-
- getType
- Créé
- 2026-08-21T05:49:24Z
Contrat
- getType is exported as a function
- getType accurately distinguishes primitive values including undefined, null, boolean, number, bigint, string, and symbol
- getType accurately distinguishes built-in objects including array, regexp, map, set, and date
- getType identifies standard functions, arrow functions, generator functions, async functions, and class constructors as function
- getType identifies plain objects and objects created with Object.create(null) as object
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Code source
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/jest-get-type@29.6.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/jest-get-type@29.6.3
Demonstrate these symbols/APIs:
- 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.
{"case":{"caseId":"case:sha256:9746989da034b3481bc7bb5b424817f37091684d7f8eee54c873402ecc42504b","contract":["getType is exported as a function","getType accurately distinguishes primitive values including undefined, null, boolean, number, bigint, string, and symbol","getType accurately distinguishes built-in objects including array, regexp, map, set, and date","getType identifies standard functions, arrow functions, generator functions, async functions, and class constructors as function","getType identifies plain objects and objects created with Object.create(null) as object"],"goal":"verify pkg:npm/jest-get-type@29.6.3","kind":"HOW","packages":["pkg:npm/jest-get-type@29.6.3"],"schemaVersion":1,"symbols":["getType"]},"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/jest-get-type@29.6.3"],"schemaVersion":1,"subject":"pkg:npm/jest-get-type@29.6.3","symbols":["getType"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-jest-get-type",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-jest-get-type",
"version": "1.0.0",
"dependencies": {
"jest-get-type": "29.6.3"
}
},
"node_modules/jest-get-type": {
"version": "29.6.3",
"resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz",
"integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==",
"license": "MIT",
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
}
}
}
{
"name": "sample-jest-get-type",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of jest-get-type",
"main": "src/index.js",
"dependencies": {
"jest-get-type": "29.6.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/jest-get-type@29.6.3",
"kind": "HOW",
"packages": [
"pkg:npm/jest-get-type@29.6.3"
],
"symbols": [
"getType"
]
}
'use strict';
const { getType, isPrimitive } = require('jest-get-type');
/**
* Returns the exact type string for any JavaScript value.
* @param {*} value
* @returns {string}
*/
function identifyType(value) {
return getType(value);
}
module.exports = {
getType,
isPrimitive,
identifyType
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { getType, isPrimitive, identifyType } = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof getType, 'function', 'getType should be a function');
assert.strictEqual(typeof isPrimitive, 'function', 'isPrimitive should be a function');
assert.strictEqual(typeof identifyType, 'function', 'identifyType should be a function');
// 2. Primitive values
assert.strictEqual(getType(undefined), 'undefined', 'undefined should return "undefined"');
assert.strictEqual(getType(null), 'null', 'null should return "null"');
assert.strictEqual(getType(true), 'boolean', 'true should return "boolean"');
assert.strictEqual(getType(false), 'boolean', 'false should return "boolean"');
assert.strictEqual(getType(0), 'number', '0 should return "number"');
assert.strictEqual(getType(-42.5), 'number', '-42.5 should return "number"');
assert.strictEqual(getType(NaN), 'number', 'NaN should return "number"');
assert.strictEqual(getType(Infinity), 'number', 'Infinity should return "number"');
assert.strictEqual(getType(-Infinity), 'number', '-Infinity should return "number"');
assert.strictEqual(getType(0n), 'bigint', '0n should return "bigint"');
assert.strictEqual(getType(9007199254740991n), 'bigint', '9007199254740991n should return "bigint"');
assert.strictEqual(getType(''), 'string', 'empty string should return "string"');
assert.strictEqual(getType('jest-get-type'), 'string', 'string should return "string"');
assert.strictEqual(getType(Symbol('sym')), 'symbol', 'symbol should return "symbol"');
assert.strictEqual(getType(Symbol.iterator), 'symbol', 'well-known symbol should return "symbol"');
// 3. Built-in objects
assert.strictEqual(getType([]), 'array', '[] should return "array"');
assert.strictEqual(getType([1, 2, 3]), 'array', '[1, 2, 3] should return "array"');
assert.strictEqual(getType(new Array(5)), 'array', 'new Array() should return "array"');
assert.strictEqual(getType(/test/i), 'regexp', '/test/i should return "regexp"');
assert.strictEqual(getType(new RegExp('test')), 'regexp', 'new RegExp() should return "regexp"');
assert.strictEqual(getType(new Map()), 'map', 'new Map() should return "map"');
assert.strictEqual(getType(new Set()), 'set', 'new Set() should return "set"');
assert.strictEqual(getType(new Date()), 'date', 'new Date() should return "date"');
// 4. Functions and classes
function standardFunction() {}
const arrowFunction = () => {};
function* generatorFunction() {}
async function asyncFunction() {}
class SampleClass {}
assert.strictEqual(getType(standardFunction), 'function', 'standard function should return "function"');
assert.strictEqual(getType(arrowFunction), 'function', 'arrow function should return "function"');
assert.strictEqual(getType(generatorFunction), 'function', 'generator function should return "function"');
assert.strictEqual(getType(asyncFunction), 'function', 'async function should return "function"');
assert.strictEqual(getType(SampleClass), 'function', 'class constructor should return "function"');
// 5. Plain objects
assert.strictEqual(getType({}), 'object', '{} should return "object"');
assert.strictEqual(getType({ a: 1, b: 'test' }), 'object', 'object with properties should return "object"');
assert.strictEqual(getType(Object.create(null)), 'object', 'Object.create(null) should return "object"');
// 6. Wrapper function consistency
assert.strictEqual(identifyType('hello'), 'string');
assert.strictEqual(identifyType([1, 2]), 'array');
assert.strictEqual(identifyType(null), 'null');
// 7. isPrimitive helper checks
assert.strictEqual(isPrimitive(123), true);
assert.strictEqual(isPrimitive('text'), true);
assert.strictEqual(isPrimitive(null), true);
assert.strictEqual(isPrimitive(undefined), true);
assert.strictEqual(isPrimitive(Symbol('s')), true);
assert.strictEqual(isPrimitive(10n), true);
assert.strictEqual(isPrimitive({}), false);
assert.strictEqual(isPrimitive([]), false);
console.log('Contract tests passed successfully.');
Seeder d'origine
anonyme