샘플
is-fullwidth-code-point 3.0.0
검증된 샘플 — npm is-fullwidth-code-point 3.0.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: isFullwidthCodePoint returns true for CJK unified…
sha256:aa6fdf87bad9070deaf4e9e1f1ca023eb2bbee9ffff73b305fe5900cba19f6fd
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-23 |
케이스
HOW- 목표
- verify pkg:npm/is-fullwidth-code-point@3.0.0
- 생성일
- 2026-08-23T07:53:13Z
컨트랙트
- isFullwidthCodePoint returns true for CJK unified ideographs and Hangul syllables
- isFullwidthCodePoint returns true for fullwidth ASCII variants and CJK punctuation
- isFullwidthCodePoint returns true for supplementary plane ideographs
- isFullwidthCodePoint returns false for standard ASCII characters and whitespace
- isFullwidthCodePoint returns false for NaN or invalid code points
- checkCodePoint and isCharFullwidth helper functions correctly determine fullwidth status from code points and strings
- calculateStringWidth calculates display width by counting 2 columns for fullwidth characters and 1 column for standard characters
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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/is-fullwidth-code-point@3.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/is-fullwidth-code-point@3.0.0
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:f76c6f46a804808daea252b1eeaaf6bce3c430b62d2f7c58075ba5c221591039","contract":["isFullwidthCodePoint returns true for CJK unified ideographs and Hangul syllables","isFullwidthCodePoint returns true for fullwidth ASCII variants and CJK punctuation","isFullwidthCodePoint returns true for supplementary plane ideographs","isFullwidthCodePoint returns false for standard ASCII characters and whitespace","isFullwidthCodePoint returns false for NaN or invalid code points","checkCodePoint and isCharFullwidth helper functions correctly determine fullwidth status from code points and strings","calculateStringWidth calculates display width by counting 2 columns for fullwidth characters and 1 column for standard characters"],"goal":"verify pkg:npm/is-fullwidth-code-point@3.0.0","kind":"HOW","packages":["pkg:npm/is-fullwidth-code-point@3.0.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/is-fullwidth-code-point@3.0.0"],"schemaVersion":1,"subject":"pkg:npm/is-fullwidth-code-point@3.0.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-is-fullwidth-code-point",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-is-fullwidth-code-point",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"is-fullwidth-code-point": "3.0.0"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"engines": {
"node": ">=8"
}
}
}
}
{
"name": "sample-is-fullwidth-code-point",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of pkg:npm/is-fullwidth-code-point@3.0.0",
"main": "src/index.mjs",
"type": "module",
"license": "MIT-0",
"dependencies": {
"is-fullwidth-code-point": "3.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/is-fullwidth-code-point@3.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/is-fullwidth-code-point@3.0.0"
]
}
import isFullwidthCodePoint from "is-fullwidth-code-point";
/**
* Checks whether a given Unicode code point is fullwidth.
*
* @param {number} codePoint - The Unicode code point to test.
* @returns {boolean} True if the code point is fullwidth, false otherwise.
*/
export function checkCodePoint(codePoint) {
return isFullwidthCodePoint(codePoint);
}
/**
* Checks whether a character at the specified index in a string is fullwidth.
*
* @param {string} str - The input string.
* @param {number} [index=0] - Character index.
* @returns {boolean} True if character at index is fullwidth.
*/
export function isCharFullwidth(str, index = 0) {
const codePoint = str.codePointAt(index);
if (codePoint === undefined) {
return false;
}
return isFullwidthCodePoint(codePoint);
}
/**
* Calculates the display width of a string considering fullwidth characters (width 2) vs standard characters (width 1).
*
* @param {string} str - The string to measure.
* @returns {number} The calculated column width.
*/
export function calculateStringWidth(str) {
let width = 0;
for (const char of str) {
const cp = char.codePointAt(0);
width += isFullwidthCodePoint(cp) ? 2 : 1;
}
return width;
}
export { isFullwidthCodePoint };
export default isFullwidthCodePoint;
import assert from "node:assert/strict";
import isFullwidthCodePoint, {
checkCodePoint,
isCharFullwidth,
calculateStringWidth,
} from "../src/index.mjs";
function testCJKAndHangul() {
// Hangul Jamo (0x1100 - 0x115F)
assert.strictEqual(isFullwidthCodePoint(0x1100), true, "Hangul Jamo should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x115f), true, "Hangul Jamo end should be fullwidth");
// Hangul Syllables (0xAC00 - 0xD7A3)
assert.strictEqual(isFullwidthCodePoint(0xac00), true, "Hangul syllable '가' should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0xd7a3), true, "Hangul syllable '힣' should be fullwidth");
// CJK Unified Ideographs (0x4E00 - 0xA4C6)
assert.strictEqual(isFullwidthCodePoint(0x4e00), true, "CJK ideograph '一' should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x9fa5), true, "CJK ideograph should be fullwidth");
}
function testFullwidthVariantsAndSymbols() {
// Fullwidth Forms (0xFF01 - 0xFF60, 0xFFE0 - 0xFFE6)
assert.strictEqual(isFullwidthCodePoint(0xff01), true, "Fullwidth exclamation mark should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0xff21), true, "Fullwidth Latin capital A should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0xffe0), true, "Fullwidth cent sign should be fullwidth");
// Angle brackets
assert.strictEqual(isFullwidthCodePoint(0x2329), true, "Left-pointing angle bracket should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x232a), true, "Right-pointing angle bracket should be fullwidth");
}
function testSupplementaryPlanes() {
// Supplementary Ideographic Plane (0x20000 - 0x3FFFD)
assert.strictEqual(isFullwidthCodePoint(0x20000), true, "Extension B ideograph should be fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x2a6d6), true, "Supplementary ideograph should be fullwidth");
}
function testStandardAsciiAndNarrow() {
// ASCII Latin letters and numbers
assert.strictEqual(isFullwidthCodePoint(0x41), false, "ASCII 'A' is not fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x61), false, "ASCII 'a' is not fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x30), false, "ASCII '0' is not fullwidth");
assert.strictEqual(isFullwidthCodePoint(0x20), false, "ASCII space is not fullwidth");
// Halfwidth Katakana (0xFF61 - 0xFFDC) are not fullwidth
assert.strictEqual(isFullwidthCodePoint(0xff61), false, "Halfwidth ideographic full stop is not fullwidth");
assert.strictEqual(isFullwidthCodePoint(0xff71), false, "Halfwidth Katakana letter A is not fullwidth");
}
function testInvalidAndNaN() {
assert.strictEqual(isFullwidthCodePoint(NaN), false, "NaN should return false");
assert.strictEqual(isFullwidthCodePoint(Number.NaN), false, "Number.NaN should return false");
}
function testHelperFunctions() {
assert.strictEqual(checkCodePoint(0xac00), true);
assert.strictEqual(checkCodePoint(0x41), false);
assert.strictEqual(isCharFullwidth("가나다", 0), true);
assert.strictEqual(isCharFullwidth("abc", 0), false);
assert.strictEqual(isCharFullwidth("", 0), false);
// String width calculation: 'Hello 세계!' -> 5 (Hello) + 1 (space) + 2*2 (세계) + 1 (!) = 11
const text = "Hello 세계!";
assert.strictEqual(calculateStringWidth(text), 11, "Width of 'Hello 세계!' should be 11");
assert.strictEqual(calculateStringWidth(""), 0);
assert.strictEqual(calculateStringWidth("全角"), 4);
}
function main() {
testCJKAndHangul();
testFullwidthVariantsAndSymbols();
testSupplementaryPlanes();
testStandardAsciiAndNarrow();
testInvalidAndNaN();
testHelperFunctions();
console.log("All pkg:npm/is-fullwidth-code-point@3.0.0 contracts passed successfully.");
}
main();
오리진 시더
익명