サンプル
@jest/get-type 30.1.0: getType, isPrimitive
検証済みサンプル — npm @jest/get-type 30.1.0: getType, isPrimitive. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: getType returns string identifier for…
sha256:087f804549111071559eb04b87e3622369039a395db0d1699ae8f8b2ab6dc59a
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-27 |
ケース
HOW- ゴール
- verify pkg:npm/%40jest/get-type@30.1.0
- パッケージ
- シンボル
-
- getType
- isPrimitive
- 環境
- node 22.23.2
- 作成日
- 2026-08-27T22:45:45Z
コントラクト
- getType returns string identifier for primitive types: undefined, null, boolean, number, string, symbol, and bigint
- getType returns string identifier for object instances: array, object, regexp, map, set, date, and function
- isPrimitive returns true for primitive values (including null and undefined) and false for objects, arrays, and functions
ファイル
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
ソース
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/%40jest/get-type@30.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jest/get-type@30.1.0
Demonstrate these symbols/APIs:
- getType
- isPrimitive
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:2f92d58a947e278892f60c4fb12fc7680fc503f2323192ee8bccba6d546fa4de","contract":["getType returns string identifier for primitive types: undefined, null, boolean, number, string, symbol, and bigint","getType returns string identifier for object instances: array, object, regexp, map, set, date, and function","isPrimitive returns true for primitive values (including null and undefined) and false for objects, arrays, and functions"],"goal":"verify pkg:npm/%40jest/get-type@30.1.0","kind":"HOW","packages":["pkg:npm/%40jest/get-type@30.1.0"],"schemaVersion":1,"symbols":["getType","isPrimitive"]},"contractCommand":["node","test/contract.cjs"],"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/%40jest/get-type@30.1.0"],"schemaVersion":1,"subject":"pkg:npm/%40jest/get-type@30.1.0","symbols":["getType","isPrimitive"],"verifierAdapter":"node-typescript@1"}
'use strict';
const { getType, isPrimitive } = require('@jest/get-type');
function describeValue(value) {
return {
type: getType(value),
isPrimitive: isPrimitive(value)
};
}
module.exports = {
describeValue,
getType,
isPrimitive
};
{
"name": "sample-jest-get-type",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-jest-get-type",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@jest/get-type": "30.1.0"
}
},
"node_modules/@jest/get-type": {
"version": "30.1.0",
"resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz",
"integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==",
"license": "MIT",
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
}
}
}
}
{
"name": "sample-jest-get-type",
"version": "1.0.0",
"private": true,
"description": "verify getType and isPrimitive in pkg:npm/%40jest/get-type@30.1.0",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"@jest/get-type": "30.1.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40jest/get-type@30.1.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40jest/get-type@30.1.0"
],
"symbols": [
"getType",
"isPrimitive"
]
}
'use strict';
const assert = require('node:assert/strict');
const { getType, isPrimitive, describeValue } = require('../index.js');
const jestGetType = require('@jest/get-type');
// 1. Verify function exports
assert.strictEqual(typeof jestGetType.getType, 'function', 'getType must be a function');
assert.strictEqual(typeof jestGetType.isPrimitive, 'function', 'isPrimitive must be a function');
assert.strictEqual(typeof describeValue, 'function', 'describeValue must be a function');
// 2. getType primitive types
assert.strictEqual(jestGetType.getType(undefined), 'undefined');
assert.strictEqual(jestGetType.getType(null), 'null');
assert.strictEqual(jestGetType.getType(true), 'boolean');
assert.strictEqual(jestGetType.getType(false), 'boolean');
assert.strictEqual(jestGetType.getType(42), 'number');
assert.strictEqual(jestGetType.getType(NaN), 'number');
assert.strictEqual(jestGetType.getType('jest'), 'string');
assert.strictEqual(jestGetType.getType(''), 'string');
assert.strictEqual(jestGetType.getType(Symbol('sym')), 'symbol');
assert.strictEqual(jestGetType.getType(100n), 'bigint');
// 3. getType reference and object types
assert.strictEqual(jestGetType.getType([]), 'array');
assert.strictEqual(jestGetType.getType([1, 2, 3]), 'array');
assert.strictEqual(jestGetType.getType({}), 'object');
assert.strictEqual(jestGetType.getType({ key: 'val' }), 'object');
assert.strictEqual(jestGetType.getType(/test-pattern/i), 'regexp');
assert.strictEqual(jestGetType.getType(new RegExp('test')), 'regexp');
assert.strictEqual(jestGetType.getType(new Map()), 'map');
assert.strictEqual(jestGetType.getType(new Set()), 'set');
assert.strictEqual(jestGetType.getType(new Date()), 'date');
assert.strictEqual(jestGetType.getType(() => {}), 'function');
assert.strictEqual(jestGetType.getType(function named() {}), 'function');
assert.strictEqual(jestGetType.getType(async () => {}), 'function');
// 4. isPrimitive validation
assert.strictEqual(jestGetType.isPrimitive(undefined), true);
assert.strictEqual(jestGetType.isPrimitive(null), true);
assert.strictEqual(jestGetType.isPrimitive(true), true);
assert.strictEqual(jestGetType.isPrimitive(false), true);
assert.strictEqual(jestGetType.isPrimitive(0), true);
assert.strictEqual(jestGetType.isPrimitive('text'), true);
assert.strictEqual(jestGetType.isPrimitive(Symbol.for('id')), true);
assert.strictEqual(jestGetType.isPrimitive(99999999999999999999n), true);
assert.strictEqual(jestGetType.isPrimitive({}), false);
assert.strictEqual(jestGetType.isPrimitive([]), false);
assert.strictEqual(jestGetType.isPrimitive(/regex/), false);
assert.strictEqual(jestGetType.isPrimitive(new Map()), false);
assert.strictEqual(jestGetType.isPrimitive(new Set()), false);
assert.strictEqual(jestGetType.isPrimitive(new Date()), false);
assert.strictEqual(jestGetType.isPrimitive(() => {}), false);
// 5. Helper function describeValue verification
const descString = describeValue('sample');
assert.deepStrictEqual(descString, { type: 'string', isPrimitive: true });
const descMap = describeValue(new Map());
assert.deepStrictEqual(descMap, { type: 'map', isPrimitive: false });
const descNull = describeValue(null);
assert.deepStrictEqual(descNull, { type: 'null', isPrimitive: true });
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名