CodeSampleX

Sample

react-is 19.2.8: isFragment

Verified sample for npm react-is 19.2.8: isFragment. The contract ran on node 22 · linux debian/x64 · docker and passed: isFragment returns true for React 19…

sha256:5e0f970f1cba079aca3eb3769a37f42daeea806771d83f79d338cb65978e16cd

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-06

Case

HOW
Goal
verify react-is.isFragment in pkg:npm/react-is@19.2.8
Packages
Symbols
  • react-is.isFragment
Environment
node 22.23.2
Created
2026-09-06T15:43:59Z

Contract

  1. isFragment returns true for React 19 transitional elements whose type is React Fragment
  2. isFragment returns false for bare React Fragment type symbol without an element wrapper
  3. isFragment returns false for legacy react.element tagged elements not using transitional element tag
  4. isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives

Files

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

Download the source artifact (tar.gz)

Source

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 react-is.isFragment in pkg:npm/react-is@19.2.8
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/react-is@19.2.8
Demonstrate these symbols/APIs:
  - react-is.isFragment
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:65a41fde3e3dcd54442866e63eaa1cc948b05b69432b3aa373d91c59c6909173","constraints":{"executionContext":"node"},"contract":["isFragment returns true for React 19 transitional elements whose type is React Fragment","isFragment returns false for bare React Fragment type symbol without an element wrapper","isFragment returns false for legacy react.element tagged elements not using transitional element tag","isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives"],"goal":"verify react-is.isFragment in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.isFragment"]},"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/react-is@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react-is@19.2.8","symbols":["react-is.isFragment"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-is-fragment",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-is-fragment",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "react-is": "19.2.8"
      }
    },
    "node_modules/react-is": {
      "version": "19.2.8",
      "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz",
      "integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-react-is-fragment",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of react-is.isFragment for React 19",
  "type": "module",
  "main": "src/index.mjs",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "react-is": "19.2.8"
  },
  "license": "MIT-0"
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify react-is.isFragment in pkg:npm/react-is@19.2.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-is@19.2.8"
  ],
  "symbols": [
    "react-is.isFragment"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.mjs
import { isFragment, Fragment, Element, typeOf } from 'react-is';

/**
 * Check if the given value is a React Fragment element.
 *
 * @param {*} value - The value to inspect.
 * @returns {boolean} True if the value is a React Fragment element.
 */
export function checkIsFragment(value) {
  return isFragment(value);
}

/**
 * Create a mock React 19 element with the specified type, props, and transitional element marker.
 *
 * @param {*} type - The element type (e.g. Fragment, string tag, component).
 * @param {object} [props={}] - Optional props object.
 * @returns {object} Mock React element object.
 */
export function createMockElement(type, props = {}) {
  return {
    $$typeof: Element,
    type,
    props,
    key: null,
    ref: null,
  };
}

/**
 * Create a mock React 19 Fragment element.
 *
 * @param {object} [props={}] - Optional props object.
 * @returns {object} Mock React Fragment element object.
 */
export function createMockFragment(props = {}) {
  return createMockElement(Fragment, props);
}

export { isFragment, Fragment, Element, typeOf };
test/contract.mjs
import assert from 'node:assert/strict';
import {
  checkIsFragment,
  createMockElement,
  createMockFragment,
  isFragment,
  Fragment,
  Element,
  typeOf,
} from '../src/index.mjs';

// 1. isFragment returns true for React 19 transitional elements whose type is React Fragment
{
  const fragmentElement = createMockFragment({ children: ['Hello', 'World'] });
  assert.equal(
    isFragment(fragmentElement),
    true,
    'isFragment must return true for React 19 Fragment element'
  );
  assert.equal(
    checkIsFragment(fragmentElement),
    true,
    'checkIsFragment helper must return true for React 19 Fragment element'
  );

  const symbolForFragment = {
    $$typeof: Symbol.for('react.transitional.element'),
    type: Symbol.for('react.fragment'),
    props: {},
    key: null,
    ref: null,
  };
  assert.equal(
    isFragment(symbolForFragment),
    true,
    'isFragment must return true for element with global Symbol.for keys'
  );
}

// 2. isFragment returns false for bare React Fragment type symbol without an element wrapper
{
  assert.equal(
    isFragment(Fragment),
    false,
    'isFragment must return false for bare Fragment symbol'
  );
  assert.equal(
    checkIsFragment(Fragment),
    false,
    'checkIsFragment helper must return false for bare Fragment symbol'
  );
  assert.equal(
    isFragment(Symbol.for('react.fragment')),
    false,
    'isFragment must return false for Symbol.for("react.fragment")'
  );
}

// 3. isFragment returns false for legacy react.element tagged elements not using transitional element tag
{
  const legacyFragment = {
    $$typeof: Symbol.for('react.element'),
    type: Fragment,
    props: {},
    key: null,
    ref: null,
  };
  assert.equal(
    isFragment(legacyFragment),
    false,
    'isFragment in React 19 must return false for legacy react.element tag'
  );
  assert.equal(
    checkIsFragment(legacyFragment),
    false,
    'checkIsFragment helper must return false for legacy react.element tag'
  );
}

// 4. isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives
{
  // Standard DOM element
  const domElement = createMockElement('div', { className: 'container' });
  assert.equal(isFragment(domElement), false, 'isFragment must return false for standard DOM element');

  // React elements with other types
  const suspenseElement = createMockElement(Symbol.for('react.suspense'), { fallback: null });
  assert.equal(isFragment(suspenseElement), false, 'isFragment must return false for suspense element');

  const plainFnElement = createMockElement(() => null);
  assert.equal(isFragment(plainFnElement), false, 'isFragment must return false for function component element');

  // Incomplete / non-element objects and primitives
  assert.equal(isFragment({}), false, 'isFragment must return false for plain empty object');
  assert.equal(isFragment({ $$typeof: Element }), false, 'isFragment must return false for element missing type');
  assert.equal(isFragment(null), false, 'isFragment must return false for null');
  assert.equal(isFragment(undefined), false, 'isFragment must return false for undefined');
  assert.equal(isFragment('<div></div>'), false, 'isFragment must return false for string');
  assert.equal(isFragment(42), false, 'isFragment must return false for number');
  assert.equal(isFragment(true), false, 'isFragment must return false for boolean');
  assert.equal(isFragment(Element), false, 'isFragment must return false for Element symbol');
}

console.log('Contract tests for react-is.isFragment (pkg:npm/react-is@19.2.8) passed successfully.');

Origin Seeder

anonymous