CodeSampleX

サンプル

unicode-match-property-ecmascript 2.0.0

検証済みサンプル — npm unicode-match-property-ecmascript 2.0.0. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: matchProperty returns canonical property…

sha256:82a606c2c900f44057eb316a97db6a8bcc5c4ca83acd4fe26d5f2c6abe40e98e

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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-28

ケース

HOW
ゴール
verify pkg:npm/unicode-match-property-ecmascript@2.0.0
パッケージ
作成日
2026-08-28T08:54:24Z

コントラクト

  1. matchProperty returns canonical property name when given a canonical property name directly
  2. matchProperty resolves short property aliases to their canonical ECMAScript property names
  3. matchProperty resolves binary property aliases to their canonical ECMAScript property names
  4. matchProperty throws an Error with Unknown property message when given an unknown property name
  5. matchProperty enforces strict case-sensitivity and throws an Error for incorrect casing

ファイル

  • PROMPT.md
  • csx.json
  • index.mjs
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

ソースアーティファクトをダウンロード (tar.gz)

ソース

PROMPT.md
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/unicode-match-property-ecmascript@2.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/unicode-match-property-ecmascript@2.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.
csx.json
{"case":{"caseId":"case:sha256:72e7ffd1377f6038c41e26cd6013e7c2d266bee3d30d8882af2ebf2b74a0b9d9","contract":["matchProperty returns canonical property name when given a canonical property name directly","matchProperty resolves short property aliases to their canonical ECMAScript property names","matchProperty resolves binary property aliases to their canonical ECMAScript property names","matchProperty throws an Error with Unknown property message when given an unknown property name","matchProperty enforces strict case-sensitivity and throws an Error for incorrect casing"],"goal":"verify pkg:npm/unicode-match-property-ecmascript@2.0.0","kind":"HOW","packages":["pkg:npm/unicode-match-property-ecmascript@2.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/unicode-match-property-ecmascript@2.0.0"],"schemaVersion":1,"subject":"pkg:npm/unicode-match-property-ecmascript@2.0.0","verifierAdapter":"node-typescript@1"}
index.mjs
import matchProperty from 'unicode-match-property-ecmascript';

/**
 * Match a Unicode property name or alias to its canonical ECMAScript property name.
 *
 * @param {string} property - Unicode property name or alias
 * @returns {string} Canonical ECMAScript property name
 */
export function getCanonicalPropertyName(property) {
  return matchProperty(property);
}

export { matchProperty };
export default matchProperty;
package-lock.json
{
  "name": "sample-unicode-match-property-ecmascript",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-unicode-match-property-ecmascript",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "unicode-match-property-ecmascript": "2.0.0"
      }
    },
    "node_modules/unicode-canonical-property-names-ecmascript": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz",
      "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==",
      "license": "MIT",
      "engines": {
        "node": ">=4"
      }
    },
    "node_modules/unicode-match-property-ecmascript": {
      "version": "2.0.0",
      "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz",
      "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==",
      "license": "MIT",
      "dependencies": {
        "unicode-canonical-property-names-ecmascript": "^2.0.0",
        "unicode-property-aliases-ecmascript": "^2.0.0"
      },
      "engines": {
        "node": ">=4"
      }
    },
    "node_modules/unicode-property-aliases-ecmascript": {
      "version": "2.2.0",
      "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.2.0.tgz",
      "integrity": "sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==",
      "license": "MIT",
      "engines": {
        "node": ">=4"
      }
    }
  }
}
package.json
{
  "name": "sample-unicode-match-property-ecmascript",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "description": "verify pkg:npm/unicode-match-property-ecmascript@2.0.0",
  "main": "index.mjs",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "unicode-match-property-ecmascript": "2.0.0"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/unicode-match-property-ecmascript@2.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/unicode-match-property-ecmascript@2.0.0"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import matchProperty from 'unicode-match-property-ecmascript';
import { getCanonicalPropertyName } from '../index.mjs';

// 1. matchProperty returns canonical property name when given a canonical property name directly
{
  assert.equal(matchProperty('Script'), 'Script');
  assert.equal(matchProperty('General_Category'), 'General_Category');
  assert.equal(matchProperty('Script_Extensions'), 'Script_Extensions');
  assert.equal(matchProperty('ASCII_Hex_Digit'), 'ASCII_Hex_Digit');
  assert.equal(getCanonicalPropertyName('Script'), 'Script');
  assert.equal(getCanonicalPropertyName('General_Category'), 'General_Category');
}

// 2. matchProperty resolves short property aliases to their canonical ECMAScript property names
{
  assert.equal(matchProperty('sc'), 'Script');
  assert.equal(matchProperty('gc'), 'General_Category');
  assert.equal(matchProperty('scx'), 'Script_Extensions');
  assert.equal(getCanonicalPropertyName('sc'), 'Script');
  assert.equal(getCanonicalPropertyName('gc'), 'General_Category');
  assert.equal(getCanonicalPropertyName('scx'), 'Script_Extensions');
}

// 3. matchProperty resolves binary property aliases to their canonical ECMAScript property names
{
  assert.equal(matchProperty('AHex'), 'ASCII_Hex_Digit');
  assert.equal(matchProperty('ASCII'), 'ASCII');
  assert.equal(matchProperty('Any'), 'Any');
  assert.equal(matchProperty('Assigned'), 'Assigned');
  assert.equal(matchProperty('IDS'), 'ID_Start');
  assert.equal(getCanonicalPropertyName('AHex'), 'ASCII_Hex_Digit');
  assert.equal(getCanonicalPropertyName('IDS'), 'ID_Start');
}

// 4. matchProperty throws an Error with Unknown property message when given an unknown property name
{
  assert.throws(
    () => matchProperty('unknown_property'),
    {
      name: 'Error',
      message: 'Unknown property: unknown_property'
    }
  );
  assert.throws(
    () => getCanonicalPropertyName('invalid_alias'),
    {
      name: 'Error',
      message: 'Unknown property: invalid_alias'
    }
  );
}

// 5. matchProperty enforces strict case-sensitivity and throws an Error for incorrect casing
{
  assert.throws(
    () => matchProperty('script'),
    {
      name: 'Error',
      message: 'Unknown property: script'
    }
  );
  assert.throws(
    () => matchProperty('general_category'),
    {
      name: 'Error',
      message: 'Unknown property: general_category'
    }
  );
  assert.throws(
    () => getCanonicalPropertyName('SC'),
    {
      name: 'Error',
      message: 'Unknown property: SC'
    }
  );
}

console.log('All contract tests passed.');

オリジンシーダー

匿名