Ejemplo
boolean 3.2.0: boolean
Muestra verificada para npm boolean 3.2.0: boolean. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó: boolean parses truthy strings…
sha256:5e6426300ffc798b7788b0c84ddbbed2b5d3e2a7b438657ce4f1738a5af2a46e
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
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-06 |
Caso
HOW- Objetivo
- verify boolean.boolean in pkg:npm/boolean@3.2.0
- Paquetes
- Símbolos
-
- boolean.boolean
- Entorno
- node 22.23.2
- Creado
- 2026-09-06T11:22:23Z
Contrato
- boolean parses truthy strings including true, t, yes, y, on, and 1 case-insensitively and trimmed
- boolean returns true for numeric 1 and boolean true
- boolean returns false for falsy strings, numbers other than 1, null, undefined, objects, and unknown strings
- boolean supports boxed String, Number, and Boolean objects
- boolean module exports the boolean function under the boolean property
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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: verify boolean.boolean in pkg:npm/boolean@3.2.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/boolean@3.2.0
Demonstrate these symbols/APIs:
- boolean.boolean
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:9eee6490e5b0194eaf26425a8c6398fe1757abc76ecaf40f02d009e30d1372c6","contract":["boolean parses truthy strings including true, t, yes, y, on, and 1 case-insensitively and trimmed","boolean returns true for numeric 1 and boolean true","boolean returns false for falsy strings, numbers other than 1, null, undefined, objects, and unknown strings","boolean supports boxed String, Number, and Boolean objects","boolean module exports the boolean function under the boolean property"],"goal":"verify boolean.boolean in pkg:npm/boolean@3.2.0","kind":"HOW","packages":["pkg:npm/boolean@3.2.0"],"schemaVersion":1,"symbols":["boolean.boolean"]},"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/boolean@3.2.0"],"schemaVersion":1,"subject":"pkg:npm/boolean@3.2.0","symbols":["boolean.boolean"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-boolean",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-boolean",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"boolean": "3.2.0"
}
},
"node_modules/boolean": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
"license": "MIT"
}
}
}
{
"name": "sample-boolean",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for boolean.boolean in boolean@3.2.0",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"boolean": "3.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify boolean.boolean in pkg:npm/boolean@3.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/boolean@3.2.0"
],
"symbols": [
"boolean.boolean"
]
}
const { boolean } = require('boolean');
/**
* Converts a string, number, boolean, or boxed object to a boolean using boolean.boolean.
*
* @param {*} value - The value to parse as a boolean.
* @returns {boolean} True if the value represents a truthy boolean, false otherwise.
*/
function parseBoolean(value) {
return boolean(value);
}
module.exports = {
boolean,
parseBoolean
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const booleanModule = require('boolean');
const { boolean, parseBoolean } = require('../src/index.js');
// 1. Module export verification: boolean is exported as a function on the module
assert.equal(typeof booleanModule.boolean, 'function', 'boolean should be exported as a function on boolean package');
assert.equal(typeof boolean, 'function', 'boolean should be a function');
assert.equal(typeof parseBoolean, 'function', 'parseBoolean wrapper should be a function');
assert.equal(booleanModule.boolean, boolean, 'imported boolean should match booleanModule.boolean');
// 2. Truthy string parsing with case-insensitivity and trimming
const truthyStrings = [
'true', 'TRUE', 'True', 't', 'T',
'yes', 'YES', 'Yes', 'y', 'Y',
'on', 'ON', 'On',
'1',
' true ', '\tYES\n', ' on '
];
for (const val of truthyStrings) {
assert.equal(boolean(val), true, `boolean(${JSON.stringify(val)}) should return true`);
assert.equal(parseBoolean(val), true, `parseBoolean(${JSON.stringify(val)}) should return true`);
}
// 3. Numeric 1 and boolean true
assert.equal(boolean(1), true, 'boolean(1) should return true');
assert.equal(boolean(true), true, 'boolean(true) should return true');
assert.equal(parseBoolean(1), true, 'parseBoolean(1) should return true');
assert.equal(parseBoolean(true), true, 'parseBoolean(true) should return true');
// 4. Falsy strings, non-1 numbers, null, undefined, empty objects, and arbitrary strings
const falsyValues = [
'false', 'FALSE', 'False', 'f', 'F',
'no', 'NO', 'No', 'n', 'N',
'off', 'OFF', 'Off',
'0',
' false ', '\tno\n',
0, -1, 2, 42, NaN, Infinity, -Infinity,
null, undefined,
{}, [], () => {},
'arbitrary', 'unknown', 'invalid', ''
];
for (const val of falsyValues) {
assert.equal(boolean(val), false, `boolean(${String(val)}) should return false`);
assert.equal(parseBoolean(val), false, `parseBoolean(${String(val)}) should return false`);
}
// 5. Boxed String, Number, and Boolean objects
assert.equal(boolean(new String('true')), true, 'boolean(new String("true")) should return true');
assert.equal(boolean(new String('yes')), true, 'boolean(new String("yes")) should return true');
assert.equal(boolean(new String('false')), false, 'boolean(new String("false")) should return false');
assert.equal(boolean(new Number(1)), true, 'boolean(new Number(1)) should return true');
assert.equal(boolean(new Number(0)), false, 'boolean(new Number(0)) should return false');
assert.equal(boolean(new Number(42)), false, 'boolean(new Number(42)) should return false');
assert.equal(boolean(new Boolean(true)), true, 'boolean(new Boolean(true)) should return true');
assert.equal(boolean(new Boolean(false)), false, 'boolean(new Boolean(false)) should return false');
console.log('Contract passed: boolean.boolean in pkg:npm/boolean@3.2.0');
Seeder de origen
anónimo