サンプル
unicode-match-property-value-ecmascript 2.2.1: match property value aliases to canonical ECMAScript Unicode property values
検証済みサンプル — npm unicode-match-property-value-ecmascript 2.2.1: match property value aliases to canonical ECMAScript Unicode property values. node 22 · linux…
sha256:3f6d0a00862262eed8c539c96f8eabe893395d616f12d8193f99473b92819756
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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 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-28 |
ケース
HOW- ゴール
- match property value aliases to canonical ECMAScript Unicode property values
- シンボル
-
- matchPropertyValue
- 環境
- node 22.23.2
- 作成日
- 2026-08-28T08:55:47Z
コントラクト
- matchPropertyValue resolves General_Category aliases and short names to canonical ECMAScript property values
- matchPropertyValue resolves Script aliases and short codes to canonical script names
- matchPropertyValue resolves Script_Extensions aliases to canonical script extension names
- matchPropertyValue throws descriptive Error on unknown property
- matchPropertyValue throws descriptive Error on invalid or unknown value for property
- resolvePropertyValues resolves multiple aliases to canonical values in sequence
- tryResolvePropertyValue safely returns canonical value or null without throwing
ファイル
- 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: match property value aliases to canonical ECMAScript Unicode property values
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/unicode-match-property-value-ecmascript@2.2.1
Demonstrate these symbols/APIs:
- matchPropertyValue
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:c09d513aa6ab175c21f8315dec4b5dc0a07aa7e163aafb15e46deb0a4f1a344b","contract":["matchPropertyValue resolves General_Category aliases and short names to canonical ECMAScript property values","matchPropertyValue resolves Script aliases and short codes to canonical script names","matchPropertyValue resolves Script_Extensions aliases to canonical script extension names","matchPropertyValue throws descriptive Error on unknown property","matchPropertyValue throws descriptive Error on invalid or unknown value for property","resolvePropertyValues resolves multiple aliases to canonical values in sequence","tryResolvePropertyValue safely returns canonical value or null without throwing"],"goal":"match property value aliases to canonical ECMAScript Unicode property values","kind":"HOW","packages":["pkg:npm/unicode-match-property-value-ecmascript@2.2.1"],"schemaVersion":1,"symbols":["matchPropertyValue"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/unicode-match-property-value-ecmascript@2.2.1"],"schemaVersion":1,"subject":"pkg:npm/unicode-match-property-value-ecmascript@2.2.1","symbols":["matchPropertyValue"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-unicode-match-property-value-ecmascript",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-unicode-match-property-value-ecmascript",
"version": "1.0.0",
"dependencies": {
"unicode-match-property-value-ecmascript": "2.2.1"
}
},
"node_modules/unicode-match-property-value-ecmascript": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.1.tgz",
"integrity": "sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg==",
"license": "MIT",
"engines": {
"node": ">=4"
}
}
}
}
{
"name": "sample-unicode-match-property-value-ecmascript",
"version": "1.0.0",
"private": true,
"description": "Match Unicode property value aliases to canonical values according to ECMAScript RegExp property escapes",
"type": "module",
"main": "src/index.js",
"dependencies": {
"unicode-match-property-value-ecmascript": "2.2.1"
}
}
{
"schemaVersion": 1,
"goal": "match property value aliases to canonical ECMAScript Unicode property values",
"kind": "HOW",
"packages": [
"pkg:npm/unicode-match-property-value-ecmascript@2.2.1"
],
"symbols": [
"matchPropertyValue"
]
}
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const matchPropertyValue = require('unicode-match-property-value-ecmascript');
/**
* Match a Unicode property value or alias to its canonical ECMAScript property value.
*
* @param {string} property - Canonical Unicode property name (e.g. 'General_Category', 'Script', 'Script_Extensions').
* @param {string} value - Property value or alias (e.g. 'C', 'Lu', 'Grek', 'Aghb').
* @returns {string} The canonical property value (e.g. 'Other', 'Uppercase_Letter', 'Greek', 'Caucasian_Albanian').
* @throws {Error} When property is unknown or value is not a valid alias/value for the property.
*/
export function resolvePropertyValue(property, value) {
return matchPropertyValue(property, value);
}
/**
* Match multiple property values against a canonical Unicode property.
*
* @param {string} property - Canonical Unicode property name.
* @param {string[]} values - List of values or aliases to resolve.
* @returns {string[]} List of resolved canonical property values.
*/
export function resolvePropertyValues(property, values) {
return values.map((val) => matchPropertyValue(property, val));
}
/**
* Safely attempt to resolve a property value, returning null if invalid rather than throwing.
*
* @param {string} property - Canonical Unicode property name.
* @param {string} value - Property value or alias.
* @returns {string|null} Canonical property value or null if unknown.
*/
export function tryResolvePropertyValue(property, value) {
try {
return matchPropertyValue(property, value);
} catch {
return null;
}
}
export { matchPropertyValue };
export default matchPropertyValue;
import assert from 'node:assert';
import {
matchPropertyValue,
resolvePropertyValue,
resolvePropertyValues,
tryResolvePropertyValue,
} from '../src/index.js';
// 1. Symbol and helper function exports verification
assert.strictEqual(typeof matchPropertyValue, 'function', 'matchPropertyValue should be a function');
assert.strictEqual(typeof resolvePropertyValue, 'function', 'resolvePropertyValue should be a function');
assert.strictEqual(typeof resolvePropertyValues, 'function', 'resolvePropertyValues should be a function');
assert.strictEqual(typeof tryResolvePropertyValue, 'function', 'tryResolvePropertyValue should be a function');
// 2. matchPropertyValue resolves General_Category aliases and canonical names
assert.strictEqual(matchPropertyValue('General_Category', 'C'), 'Other');
assert.strictEqual(matchPropertyValue('General_Category', 'Cc'), 'Control');
assert.strictEqual(matchPropertyValue('General_Category', 'cntrl'), 'Control');
assert.strictEqual(matchPropertyValue('General_Category', 'digit'), 'Decimal_Number');
assert.strictEqual(matchPropertyValue('General_Category', 'Nd'), 'Decimal_Number');
assert.strictEqual(matchPropertyValue('General_Category', 'Decimal_Number'), 'Decimal_Number');
assert.strictEqual(matchPropertyValue('General_Category', 'Lu'), 'Uppercase_Letter');
assert.strictEqual(matchPropertyValue('General_Category', 'Uppercase_Letter'), 'Uppercase_Letter');
assert.strictEqual(matchPropertyValue('General_Category', 'punct'), 'Punctuation');
// 3. matchPropertyValue resolves Script aliases and canonical names
assert.strictEqual(matchPropertyValue('Script', 'Grek'), 'Greek');
assert.strictEqual(matchPropertyValue('Script', 'Greek'), 'Greek');
assert.strictEqual(matchPropertyValue('Script', 'Latn'), 'Latin');
assert.strictEqual(matchPropertyValue('Script', 'Latin'), 'Latin');
assert.strictEqual(matchPropertyValue('Script', 'Hani'), 'Han');
assert.strictEqual(matchPropertyValue('Script', 'Han'), 'Han');
// 4. matchPropertyValue resolves Script_Extensions aliases and canonical names
assert.strictEqual(matchPropertyValue('Script_Extensions', 'Aghb'), 'Caucasian_Albanian');
assert.strictEqual(matchPropertyValue('Script_Extensions', 'Caucasian_Albanian'), 'Caucasian_Albanian');
assert.strictEqual(matchPropertyValue('Script_Extensions', 'Arab'), 'Arabic');
assert.strictEqual(matchPropertyValue('Script_Extensions', 'Arabic'), 'Arabic');
// 5. matchPropertyValue throws descriptive Error on unknown property
assert.throws(
() => matchPropertyValue('UnknownProperty', 'Letter'),
{
name: 'Error',
message: 'Unknown property `UnknownProperty`.'
}
);
// 6. matchPropertyValue throws descriptive Error on invalid or unknown value for property
assert.throws(
() => matchPropertyValue('General_Category', 'NonexistentValue'),
{
name: 'Error',
message: 'Unknown value `NonexistentValue` for property `General_Category`.'
}
);
assert.throws(
() => matchPropertyValue('Script', 'InvalidScript'),
{
name: 'Error',
message: 'Unknown value `InvalidScript` for property `Script`.'
}
);
// 7. Helpers resolve collections and safe lookups
assert.deepStrictEqual(
resolvePropertyValues('General_Category', ['Lu', 'Ll', 'Nd']),
['Uppercase_Letter', 'Lowercase_Letter', 'Decimal_Number']
);
assert.strictEqual(tryResolvePropertyValue('General_Category', 'Nd'), 'Decimal_Number');
assert.strictEqual(tryResolvePropertyValue('General_Category', 'invalid'), null);
assert.strictEqual(tryResolvePropertyValue('InvalidProp', 'Nd'), null);
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名