Ejemplo
boolean 3.2.0: isBooleanable
Muestra verificada para npm boolean 3.2.0: isBooleanable. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:f2f2fcec40894bdf8b8f316c3dd3fddf3d83d1213d54dfb2f4ca6adb66f62516
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.isBooleanable in pkg:npm/boolean@3.2.0
- Paquetes
- Símbolos
-
- boolean.isBooleanable
- Entorno
- node 22.23.2
- Creado
- 2026-09-06T11:58:19Z
Contrato
- isBooleanable returns true for truthy strings including true, t, yes, y, on, and 1 case-insensitively and trimmed
- isBooleanable returns true for falsy strings including false, f, no, n, off, and 0 case-insensitively and trimmed
- isBooleanable returns true for numeric 0, numeric 1, and boolean true and false
- isBooleanable returns true for boxed String, Number, and Boolean objects representing boolean values
- isBooleanable returns false for non-boolean numbers, arbitrary strings, null, undefined, and objects
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.isBooleanable 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.isBooleanable
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:ef422e2a88eb73c8388a5d8d39bbc866e098826aba0edc3df27adb962c45eef8","contract":["isBooleanable returns true for truthy strings including true, t, yes, y, on, and 1 case-insensitively and trimmed","isBooleanable returns true for falsy strings including false, f, no, n, off, and 0 case-insensitively and trimmed","isBooleanable returns true for numeric 0, numeric 1, and boolean true and false","isBooleanable returns true for boxed String, Number, and Boolean objects representing boolean values","isBooleanable returns false for non-boolean numbers, arbitrary strings, null, undefined, and objects"],"goal":"verify boolean.isBooleanable in pkg:npm/boolean@3.2.0","kind":"HOW","packages":["pkg:npm/boolean@3.2.0"],"schemaVersion":1,"symbols":["boolean.isBooleanable"]},"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.isBooleanable"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-boolean-is-booleanable",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-boolean-is-booleanable",
"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-is-booleanable",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for boolean.isBooleanable in pkg:npm/boolean@3.2.0",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"boolean": "3.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify boolean.isBooleanable in pkg:npm/boolean@3.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/boolean@3.2.0"
],
"symbols": [
"boolean.isBooleanable"
]
}
const { isBooleanable, boolean } = require('boolean');
/**
* Validates whether a given value can be interpreted as a boolean.
*
* Recognized truthy representations:
* - 'true', 't', 'yes', 'y', 'on', '1' (case-insensitive, trimmed)
* - 1
* - true
*
* Recognized falsy representations:
* - 'false', 'f', 'no', 'n', 'off', '0' (case-insensitive, trimmed)
* - 0
* - false
*
* Also supports boxed String, Number, and Boolean objects.
*
* @param {*} value - The input value to check.
* @returns {boolean} True if the value is booleanable, false otherwise.
*/
function checkIsBooleanable(value) {
return isBooleanable(value);
}
module.exports = {
isBooleanable,
boolean,
checkIsBooleanable
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { isBooleanable, checkIsBooleanable } = require('../src/index.js');
// 1. Export verification
assert.equal(typeof isBooleanable, 'function', 'isBooleanable should be exported as a function');
assert.equal(typeof checkIsBooleanable, 'function', 'checkIsBooleanable should be exported as a function');
// 2. Truthy strings (case-insensitive and whitespace-tolerant)
const truthyStrings = ['true', 'TRUE', 'True', 't', 'T', 'yes', 'YES', 'y', 'Y', 'on', 'ON', '1', ' true ', '\tyes\n', ' ON '];
for (const val of truthyStrings) {
assert.equal(isBooleanable(val), true, `isBooleanable(${JSON.stringify(val)}) should be true`);
assert.equal(checkIsBooleanable(val), true, `checkIsBooleanable(${JSON.stringify(val)}) should be true`);
}
// 3. Falsy strings (case-insensitive and whitespace-tolerant)
const falsyStrings = ['false', 'FALSE', 'False', 'f', 'F', 'no', 'NO', 'n', 'N', 'off', 'OFF', '0', ' false ', '\tno\n', ' OFF '];
for (const val of falsyStrings) {
assert.equal(isBooleanable(val), true, `isBooleanable(${JSON.stringify(val)}) should be true`);
assert.equal(checkIsBooleanable(val), true, `checkIsBooleanable(${JSON.stringify(val)}) should be true`);
}
// 4. Numeric 0, 1 and boolean literals
assert.equal(isBooleanable(0), true, 'isBooleanable(0) should be true');
assert.equal(isBooleanable(1), true, 'isBooleanable(1) should be true');
assert.equal(isBooleanable(true), true, 'isBooleanable(true) should be true');
assert.equal(isBooleanable(false), true, 'isBooleanable(false) should be true');
assert.equal(checkIsBooleanable(0), true, 'checkIsBooleanable(0) should be true');
assert.equal(checkIsBooleanable(1), true, 'checkIsBooleanable(1) should be true');
assert.equal(checkIsBooleanable(true), true, 'checkIsBooleanable(true) should be true');
assert.equal(checkIsBooleanable(false), true, 'checkIsBooleanable(false) should be true');
// 5. Boxed String, Number, and Boolean objects
assert.equal(isBooleanable(new String('true')), true, 'isBooleanable(new String("true")) should be true');
assert.equal(isBooleanable(new String('false')), true, 'isBooleanable(new String("false")) should be true');
assert.equal(isBooleanable(new String('YES')), true, 'isBooleanable(new String("YES")) should be true');
assert.equal(isBooleanable(new String('off')), true, 'isBooleanable(new String("off")) should be true');
assert.equal(isBooleanable(new Number(1)), true, 'isBooleanable(new Number(1)) should be true');
assert.equal(isBooleanable(new Number(0)), true, 'isBooleanable(new Number(0)) should be true');
assert.equal(isBooleanable(new Boolean(true)), true, 'isBooleanable(new Boolean(true)) should be true');
assert.equal(isBooleanable(new Boolean(false)), true, 'isBooleanable(new Boolean(false)) should be true');
// 6. Non-boolean numbers, arbitrary strings, null, undefined, and objects
const nonBooleanables = [
'foo', 'bar', '2', '-1', 'truthy', 'falsy', 'null', 'undefined',
2, -1, 100, 3.14, NaN, Infinity, -Infinity,
null, undefined,
{}, [], () => {}, Symbol('test'), new Date()
];
for (const val of nonBooleanables) {
assert.equal(isBooleanable(val), false, `isBooleanable(${String(val)}) should be false`);
assert.equal(checkIsBooleanable(val), false, `checkIsBooleanable(${String(val)}) should be false`);
}
console.log('All boolean.isBooleanable contract tests passed successfully.');
Seeder de origen
anónimo