CodeSampleX

Beispiel

@webassemblyjs/floating-point-hex-parser 1.13.2: default

Verifiziertes Beispiel für npm @webassemblyjs/floating-point-hex-parser 1.13.2: default. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:75e8d41252ff70c1150463ab5fefb34e466f4df0776f70c0fe558d5fb648a79e

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2
Pakete
Symbole
  • default
Umgebung
node 22.23.2
Erstellt
2026-08-27T23:17:56Z

Contract

  1. parseHexFloat parses floating point hexadecimal string with negative binary exponent to IEEE 754 float
  2. parseHexFloat parses floating point hexadecimal string with fractional mantissa and positive binary exponent
  3. parseHexFloat parses hexadecimal integer string without exponent component
  4. parseHexFloat correctly preserves negative sign for hexadecimal floating point values

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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/%40webassemblyjs/floating-point-hex-parser@1.13.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2
Demonstrate these symbols/APIs:
  - default

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:c281b20675cc11a4cc84ff45e7172104f1abef110e250c181d1d9c988343b19b","contract":["parseHexFloat parses floating point hexadecimal string with negative binary exponent to IEEE 754 float","parseHexFloat parses floating point hexadecimal string with fractional mantissa and positive binary exponent","parseHexFloat parses hexadecimal integer string without exponent component","parseHexFloat correctly preserves negative sign for hexadecimal floating point values"],"goal":"verify pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2","kind":"HOW","packages":["pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2"],"schemaVersion":1,"symbols":["default"]},"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/%40webassemblyjs/floating-point-hex-parser@1.13.2"],"schemaVersion":1,"subject":"pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2","symbols":["default"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-floating-point-hex-parser",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-floating-point-hex-parser",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@webassemblyjs/floating-point-hex-parser": "1.13.2"
      }
    },
    "node_modules/@webassemblyjs/floating-point-hex-parser": {
      "version": "1.13.2",
      "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
      "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-floating-point-hex-parser",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "@webassemblyjs/floating-point-hex-parser": "1.13.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40webassemblyjs/floating-point-hex-parser@1.13.2"
  ],
  "symbols": [
    "default"
  ]
}
src/index.mjs
import parseHexFloatModule from "@webassemblyjs/floating-point-hex-parser";

const rawParse = typeof parseHexFloatModule === "function"
  ? parseHexFloatModule
  : parseHexFloatModule.default;

/**
 * Parses a floating point hexadecimal string into an IEEE 754 number.
 *
 * @param {string} input - Hexadecimal floating point string (e.g., "0x1p-1", "0x1.8p1")
 * @returns {number} The parsed JavaScript number
 */
export function parseHexFloat(input) {
  return rawParse(input);
}

export default parseHexFloat;
test/contract.mjs
import assert from "node:assert/strict";
import parseHexFloatModule from "@webassemblyjs/floating-point-hex-parser";
import { parseHexFloat } from "../src/index.mjs";

const rawParse = typeof parseHexFloatModule === "function"
  ? parseHexFloatModule
  : parseHexFloatModule.default;

// 1. parseHexFloat parses floating point hexadecimal string with negative binary exponent to IEEE 754 float
{
  assert.equal(rawParse("0x1p-1"), 0.5);
  assert.equal(parseHexFloat("0x1p-1"), 0.5);
  assert.equal(parseHexFloat("0x1p-2"), 0.25);
  assert.equal(parseHexFloat("0x1p-3"), 0.125);
}

// 2. parseHexFloat parses floating point hexadecimal string with fractional mantissa and positive binary exponent
{
  assert.equal(rawParse("0x1.8p1"), 3);
  assert.equal(parseHexFloat("0x1.8p1"), 3);
  assert.equal(parseHexFloat("0x1.4p3"), 10);
  assert.equal(parseHexFloat("0x1.921fb54442d18p+2"), 6.283185307179586);
}

// 3. parseHexFloat parses hexadecimal integer string without exponent component
{
  assert.equal(rawParse("0x0"), 0);
  assert.equal(parseHexFloat("0x0"), 0);
  assert.equal(parseHexFloat("0x10"), 16);
  assert.equal(parseHexFloat("0xFF"), 255);
}

// 4. parseHexFloat correctly preserves negative sign for hexadecimal floating point values
{
  assert.equal(rawParse("-0x1p0"), -1);
  assert.equal(parseHexFloat("-0x1p0"), -1);
  assert.equal(parseHexFloat("-0x1p-1"), -0.5);
  assert.equal(parseHexFloat("-0x1.8p1"), -3);
}

console.log("All floating-point-hex-parser contract tests passed successfully.");

Ursprungs-Seeder

anonym