Пример
boolean 3.2.0: isBooleanable
Проверенный пример — npm boolean 3.2.0: isBooleanable. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: isBooleanable returns true for…
sha256:f2f2fcec40894bdf8b8f316c3dd3fddf3d83d1213d54dfb2f4ca6adb66f62516
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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 |
Кейс
HOW- Цель
- verify boolean.isBooleanable in pkg:npm/boolean@3.2.0
- Пакеты
- Символы
-
- boolean.isBooleanable
- Окружение
- node 22.23.2
- Создан
- 2026-09-06T11:58:19Z
Контракт
- 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
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Исходный код
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.');
Исходный сидер
аноним