샘플
boolean 3.2.0: boolean
검증된 샘플 — npm boolean 3.2.0: boolean. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: boolean parses truthy strings including true, t, yes, y, on…
sha256:c4e66cd29d6cbf77e03fb2ecb93d76e15bc16d16c85121ac8e982d28af025331
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-26 |
케이스
HOW- 목표
- verify pkg:npm/boolean@3.2.0
- 패키지
- 심벌
-
- boolean
- 환경
- node 22.23.2
- 생성일
- 2026-08-26T07:54:04Z
컨트랙트
- 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
- isBooleanable returns true for valid truthy and falsy boolean representations
- isBooleanable returns false for unparseable strings, numbers other than 0 and 1, 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 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
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:ac0b1d0a0008b34012352f3310daf539c1fa6addbf6b2f94cfe823c58af52378","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","isBooleanable returns true for valid truthy and falsy boolean representations","isBooleanable returns false for unparseable strings, numbers other than 0 and 1, null, undefined, and objects"],"goal":"verify pkg:npm/boolean@3.2.0","kind":"HOW","packages":["pkg:npm/boolean@3.2.0"],"schemaVersion":1,"symbols":["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"],"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@3.2.0",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"boolean": "3.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/boolean@3.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/boolean@3.2.0"
],
"symbols": [
"boolean"
]
}
const { boolean, isBooleanable } = require('boolean');
/**
* Converts various values (string, number, boolean, wrappers) to a boolean.
*
* @param {*} value - The input value to convert.
* @returns {boolean} True if the value represents a truthy boolean string/number/boolean, false otherwise.
*/
function toBoolean(value) {
return boolean(value);
}
/**
* Checks whether a value can be parsed or interpreted as a valid boolean representation.
*
* @param {*} value - The input value to test.
* @returns {boolean} True if the value represents a known boolean or boolean-like string/number.
*/
function checkBooleanable(value) {
return isBooleanable(value);
}
module.exports = {
boolean,
isBooleanable,
toBoolean,
checkBooleanable
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const { boolean, isBooleanable, toBoolean, checkBooleanable } = require('../src/index.js');
// 1. Export verification
assert.equal(typeof boolean, 'function', 'boolean should be exported as a function');
assert.equal(typeof isBooleanable, 'function', 'isBooleanable should be exported as a function');
assert.equal(typeof toBoolean, 'function', 'toBoolean helper should be a function');
assert.equal(typeof checkBooleanable, 'function', 'checkBooleanable helper should be a function');
// 2. Truthy string parsing with case-insensitivity and trimming
const truthyStrings = ['true', 'TRUE', 'True', 't', 'T', 'yes', 'YES', 'y', 'Y', 'on', 'ON', '1', ' true ', '\tyes\n'];
for (const val of truthyStrings) {
assert.equal(boolean(val), true, `boolean(${JSON.stringify(val)}) should be true`);
assert.equal(toBoolean(val), true, `toBoolean(${JSON.stringify(val)}) should be true`);
}
// 3. Numeric 1 and boolean true
assert.equal(boolean(1), true, 'boolean(1) should be true');
assert.equal(boolean(true), true, 'boolean(true) should be true');
assert.equal(toBoolean(1), true, 'toBoolean(1) should be true');
assert.equal(toBoolean(true), true, 'toBoolean(true) should be true');
// 4. Falsy strings, non-1 numbers, null, undefined, objects, and arbitrary strings
const falsyValues = ['false', 'FALSE', 'f', 'F', 'no', 'NO', 'n', 'N', 'off', 'OFF', '0', ' false ', 0, -1, 2, 42, NaN, Infinity, null, undefined, {}, [], () => {}, 'unknown', 'invalid'];
for (const val of falsyValues) {
assert.equal(boolean(val), false, `boolean(${String(val)}) should be false`);
assert.equal(toBoolean(val), false, `toBoolean(${String(val)}) should be false`);
}
// 5. Boxed String, Number, and Boolean objects
assert.equal(boolean(new String('true')), true, 'boolean(new String("true")) should be true');
assert.equal(boolean(new String('YES')), true, 'boolean(new String("YES")) should be true');
assert.equal(boolean(new String('false')), false, 'boolean(new String("false")) should be false');
assert.equal(boolean(new Number(1)), true, 'boolean(new Number(1)) should be true');
assert.equal(boolean(new Number(0)), false, 'boolean(new Number(0)) should be false');
assert.equal(boolean(new Boolean(true)), true, 'boolean(new Boolean(true)) should be true');
assert.equal(boolean(new Boolean(false)), false, 'boolean(new Boolean(false)) should be false');
// 6. isBooleanable returns true for recognized boolean representations
const booleanableValues = [
'true', 'TRUE', 't', 'T', 'yes', 'YES', 'y', 'Y', 'on', 'ON', '1',
'false', 'FALSE', 'f', 'F', 'no', 'NO', 'n', 'N', 'off', 'OFF', '0',
' true ', ' false ',
1, 0, true, false,
new String('true'), new String('false'), new Number(1), new Number(0), new Boolean(true), new Boolean(false)
];
for (const val of booleanableValues) {
assert.equal(isBooleanable(val), true, `isBooleanable(${String(val)}) should be true`);
assert.equal(checkBooleanable(val), true, `checkBooleanable(${String(val)}) should be true`);
}
// 7. isBooleanable returns false for unparseable or arbitrary values
const nonBooleanableValues = ['foo', 'bar', '2', '-1', 2, -1, 100, NaN, Infinity, null, undefined, {}, [], () => {}];
for (const val of nonBooleanableValues) {
assert.equal(isBooleanable(val), false, `isBooleanable(${String(val)}) should be false`);
assert.equal(checkBooleanable(val), false, `checkBooleanable(${String(val)}) should be false`);
}
console.log('All boolean@3.2.0 contract tests passed successfully.');
오리진 시더
익명