Ejemplo
type-detect 4.0.8: type detection for primitives, built-ins, and complex JavaScript objects using type-detect
Muestra verificada para npm type-detect 4.0.8: type detection for primitives, built-ins, and complex JavaScript objects using type-detect. El contrato se…
sha256:cdbd7ba6fa2e2fa4e23268791e70644ce520d8ed87a8521630dbf86f26941c24
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-27 |
Caso
HOW- Objetivo
- type detection for primitives, built-ins, and complex JavaScript objects using type-detect
- Paquetes
- Símbolos
-
- typeDetect
- Creado
- 2026-08-27T21:21:10Z
Contrato
- typeDetect(null) === "null"
- typeDetect(undefined) === "undefined"
- typeDetect(42) === "number"
- typeDetect(NaN) === "number"
- typeDetect("hello") === "string"
- typeDetect(true) === "boolean"
- typeDetect(Symbol("test")) === "symbol"
- typeDetect(100n) === "bigint"
- typeDetect([]) === "Array"
- typeDetect({}) === "Object"
- typeDetect(new Map()) === "Map"
- typeDetect(new Set()) === "Set"
- typeDetect(new WeakMap()) === "WeakMap"
- typeDetect(new WeakSet()) === "WeakSet"
- typeDetect(Promise.resolve()) === "Promise"
- typeDetect(/regex/g) === "RegExp"
- typeDetect(new Date()) === "Date"
- typeDetect(new Error("err")) === "Error"
- typeDetect(new Uint8Array(8)) === "Uint8Array"
- typeDetect(new ArrayBuffer(16)) === "ArrayBuffer"
- typeDetect(new DataView(new ArrayBuffer(16))) === "DataView"
- typeDetect(() => {}) === "function"
- typeDetect(function named() {}) === "function"
Archivos
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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: type detection for primitives, built-ins, and complex JavaScript objects using type-detect
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/type-detect@4.0.8
Demonstrate these symbols/APIs:
- typeDetect
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:2553da6ffcd6a1cd3e0f9ea093ea32a7c618d2c92c5f8bd42ae6263d6b35beef","contract":["typeDetect(null) === \"null\"","typeDetect(undefined) === \"undefined\"","typeDetect(42) === \"number\"","typeDetect(NaN) === \"number\"","typeDetect(\"hello\") === \"string\"","typeDetect(true) === \"boolean\"","typeDetect(Symbol(\"test\")) === \"symbol\"","typeDetect(100n) === \"bigint\"","typeDetect([]) === \"Array\"","typeDetect({}) === \"Object\"","typeDetect(new Map()) === \"Map\"","typeDetect(new Set()) === \"Set\"","typeDetect(new WeakMap()) === \"WeakMap\"","typeDetect(new WeakSet()) === \"WeakSet\"","typeDetect(Promise.resolve()) === \"Promise\"","typeDetect(/regex/g) === \"RegExp\"","typeDetect(new Date()) === \"Date\"","typeDetect(new Error(\"err\")) === \"Error\"","typeDetect(new Uint8Array(8)) === \"Uint8Array\"","typeDetect(new ArrayBuffer(16)) === \"ArrayBuffer\"","typeDetect(new DataView(new ArrayBuffer(16))) === \"DataView\"","typeDetect(() =\u003e {}) === \"function\"","typeDetect(function named() {}) === \"function\""],"goal":"type detection for primitives, built-ins, and complex JavaScript objects using type-detect","kind":"HOW","packages":["pkg:npm/type-detect@4.0.8"],"schemaVersion":1,"symbols":["typeDetect"]},"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/type-detect@4.0.8"],"schemaVersion":1,"subject":"pkg:npm/type-detect@4.0.8","symbols":["typeDetect"],"verifierAdapter":"node-typescript@1"}
import typeDetect from 'type-detect';
/**
* Returns the exact type of the given value.
* Distinguishes primitives, built-ins, and complex objects.
*
* @param {*} value
* @returns {string}
*/
export function identifyType(value) {
return typeDetect(value);
}
export default typeDetect;
{
"name": "type-detect-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "type-detect-sample",
"version": "1.0.0",
"dependencies": {
"type-detect": "4.0.8"
}
},
"node_modules/type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"license": "MIT",
"engines": {
"node": ">=4"
}
}
}
}
{
"name": "type-detect-sample",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"type-detect": "4.0.8"
}
}
{
"schemaVersion": 1,
"goal": "type detection for primitives, built-ins, and complex JavaScript objects using type-detect",
"kind": "HOW",
"packages": [
"pkg:npm/type-detect@4.0.8"
],
"symbols": [
"typeDetect"
]
}
import assert from 'node:assert/strict';
import typeDetect from 'type-detect';
import { identifyType } from '../index.mjs';
// Primitive types
assert.equal(typeDetect(null), 'null');
assert.equal(typeDetect(undefined), 'undefined');
assert.equal(typeDetect(42), 'number');
assert.equal(typeDetect(NaN), 'number');
assert.equal(typeDetect('hello'), 'string');
assert.equal(typeDetect(true), 'boolean');
assert.equal(typeDetect(Symbol('test')), 'symbol');
assert.equal(typeDetect(100n), 'bigint');
// Built-in objects and collections
assert.equal(typeDetect([]), 'Array');
assert.equal(typeDetect({}), 'Object');
assert.equal(typeDetect(new Map()), 'Map');
assert.equal(typeDetect(new Set()), 'Set');
assert.equal(typeDetect(new WeakMap()), 'WeakMap');
assert.equal(typeDetect(new WeakSet()), 'WeakSet');
assert.equal(typeDetect(Promise.resolve()), 'Promise');
assert.equal(typeDetect(/regex/g), 'RegExp');
assert.equal(typeDetect(new Date()), 'Date');
assert.equal(typeDetect(new Error('err')), 'Error');
assert.equal(typeDetect(new Uint8Array(8)), 'Uint8Array');
assert.equal(typeDetect(new ArrayBuffer(16)), 'ArrayBuffer');
assert.equal(typeDetect(new DataView(new ArrayBuffer(16))), 'DataView');
// Functions
assert.equal(typeDetect(() => {}), 'function');
assert.equal(typeDetect(function named() {}), 'function');
// identifyType helper wrapper
assert.equal(identifyType([1, 2, 3]), 'Array');
assert.equal(identifyType(new Map()), 'Map');
console.log('Contract passed');
Seeder de origen
anónimo