サンプル
boolean 3.2.0: boolean
検証済みサンプル — npm boolean 3.2.0: boolean. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: boolean parses truthy strings including true, t, yes, y…
sha256:5e6426300ffc798b7788b0c84ddbbed2b5d3e2a7b438657ce4f1738a5af2a46e
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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.boolean in pkg:npm/boolean@3.2.0
- パッケージ
- シンボル
-
- boolean.boolean
- 環境
- node 22.23.2
- 作成日
- 2026-09-06T11:22:23Z
コントラクト
- 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
ファイル
- 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.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');
オリジンシーダー
匿名