CodeSampleX

Sample

entities 6.0.1: decodeHTMLStrict

Verified sample for npm entities 6.0.1: decodeHTMLStrict. The contract ran on node 22 · linux debian/x64 · docker and passed: assert…

sha256:135d55d699973239a4ec97c4608f37543d0687bba41c5efa6f6ebf3b0cf5be1c

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 linux 24 · ubuntu · glibc 2.39 x64 npm

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-07

Case

HOW
Goal
verify entities.decodeHTMLStrict in pkg:npm/entities@6.0.1
Packages
Symbols
  • entities.decodeHTMLStrict
Created
2026-09-07T01:22:27Z

Contract

  1. assert entities.decodeHTMLStrict decodes standard named HTML entities terminated with a semicolon
  2. assert entities.decodeHTMLStrict does not decode legacy named entities lacking a trailing semicolon
  3. assert entities.decodeHTMLStrict decodes decimal numeric character references
  4. assert entities.decodeHTMLStrict decodes hexadecimal numeric character references
  5. assert entities.decodeHTMLStrict returns empty string for empty input and preserves unescaped plain text
  6. assert entities.decodeHTMLStrict decodes complex mixed HTML content with multiple entities

Files

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • 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 entities.decodeHTMLStrict in pkg:npm/entities@6.0.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/entities@6.0.1
Demonstrate these symbols/APIs:
  - entities.decodeHTMLStrict

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:7b44d6c450077d5edb22b5aa952e6c2e33c3a088931b9a007e9b231cf0895e8b","contract":["assert entities.decodeHTMLStrict decodes standard named HTML entities terminated with a semicolon","assert entities.decodeHTMLStrict does not decode legacy named entities lacking a trailing semicolon","assert entities.decodeHTMLStrict decodes decimal numeric character references","assert entities.decodeHTMLStrict decodes hexadecimal numeric character references","assert entities.decodeHTMLStrict returns empty string for empty input and preserves unescaped plain text","assert entities.decodeHTMLStrict decodes complex mixed HTML content with multiple entities"],"goal":"verify entities.decodeHTMLStrict in pkg:npm/entities@6.0.1","kind":"HOW","packages":["pkg:npm/entities@6.0.1"],"schemaVersion":1,"symbols":["entities.decodeHTMLStrict"]},"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/entities@6.0.1"],"schemaVersion":1,"subject":"pkg:npm/entities@6.0.1","symbols":["entities.decodeHTMLStrict"],"verifierAdapter":"node-typescript@1"}
index.js
const entities = require('entities');

function decodeHTMLStrict(text) {
  return entities.decodeHTMLStrict(text);
}

function decodeNamedStrict(text) {
  return entities.decodeHTMLStrict(text);
}

function decodeNumericStrict(text) {
  return entities.decodeHTMLStrict(text);
}

module.exports = {
  decodeHTMLStrict,
  decodeNamedStrict,
  decodeNumericStrict,
  entities,
};
package-lock.json
{
  "name": "sample-entities-decode-html-strict",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-entities-decode-html-strict",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "entities": "6.0.1"
      }
    },
    "node_modules/entities": {
      "version": "6.0.1",
      "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
      "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
      "license": "BSD-2-Clause",
      "engines": {
        "node": ">=0.12"
      },
      "funding": {
        "url": "https://github.com/fb55/entities?sponsor=1"
      }
    }
  }
}
package.json
{
  "name": "sample-entities-decode-html-strict",
  "version": "1.0.0",
  "description": "Minimal clean-room sample verifying entities.decodeHTMLStrict in entities",
  "main": "index.js",
  "license": "MIT-0",
  "dependencies": {
    "entities": "6.0.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify entities.decodeHTMLStrict in pkg:npm/entities@6.0.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/entities@6.0.1"
  ],
  "symbols": [
    "entities.decodeHTMLStrict"
  ]
}
test/contract.mjs
import assert from 'node:assert';
import * as entities from 'entities';
import {
  decodeHTMLStrict,
  decodeNamedStrict,
  decodeNumericStrict,
} from '../index.js';

// 1. assert entities.decodeHTMLStrict decodes standard named HTML entities terminated with a semicolon
assert.strictEqual(decodeHTMLStrict('&'), '&', 'Must decode &');
assert.strictEqual(decodeHTMLStrict('&lt;'), '<', 'Must decode &lt;');
assert.strictEqual(decodeHTMLStrict('&gt;'), '>', 'Must decode &gt;');
assert.strictEqual(decodeHTMLStrict('&quot;'), '"', 'Must decode &quot;');
assert.strictEqual(decodeHTMLStrict('&apos;'), "'", 'Must decode &apos;');
assert.strictEqual(decodeHTMLStrict('&copy;'), '©', 'Must decode &copy;');
assert.strictEqual(decodeHTMLStrict('&euro;'), '€', 'Must decode &euro;');
assert.strictEqual(entities.decodeHTMLStrict('&amp;'), '&', 'Direct export decodeHTMLStrict must match');

// 2. assert entities.decodeHTMLStrict does not decode legacy named entities lacking a trailing semicolon
assert.strictEqual(decodeHTMLStrict('&amp'), '&amp', 'Must not decode &amp without semicolon');
assert.strictEqual(decodeHTMLStrict('&copy'), '&copy', 'Must not decode &copy without semicolon');
assert.strictEqual(decodeHTMLStrict('&lt'), '&lt', 'Must not decode &lt without semicolon');
assert.strictEqual(decodeHTMLStrict('&gt'), '&gt', 'Must not decode &gt without semicolon');

// 3. assert entities.decodeHTMLStrict decodes decimal numeric character references
assert.strictEqual(decodeNumericStrict('&#65;'), 'A', 'Must decode decimal &#65; to A');
assert.strictEqual(decodeNumericStrict('&#169;'), '©', 'Must decode decimal &#169; to ©');
assert.strictEqual(decodeNumericStrict('&#8364;'), '€', 'Must decode decimal &#8364; to €');

// 4. assert entities.decodeHTMLStrict decodes hexadecimal numeric character references
assert.strictEqual(decodeNumericStrict('&#x41;'), 'A', 'Must decode hex &#x41; to A');
assert.strictEqual(decodeNumericStrict('&#x20AC;'), '€', 'Must decode hex &#x20AC; to €');
assert.strictEqual(decodeNumericStrict('&#x1F600;'), '😀', 'Must decode hex &#x1F600; to emoji');

// 5. assert entities.decodeHTMLStrict returns empty string for empty input and preserves unescaped plain text
assert.strictEqual(decodeNamedStrict(''), '', 'Empty string must return empty string');
assert.strictEqual(decodeNamedStrict('Hello, world!'), 'Hello, world!', 'Plain text without entities must remain unchanged');
assert.strictEqual(decodeNamedStrict('12345'), '12345', 'Numbers without entities must remain unchanged');

// 6. assert entities.decodeHTMLStrict decodes complex mixed HTML content with multiple entities
const complexInput = '&lt;span class=&quot;price&quot;&gt;&euro;100 &amp;amp; tax&lt;/span&gt;';
const expectedOutput = '<span class="price">€100 &amp; tax</span>';
assert.strictEqual(decodeHTMLStrict(complexInput), expectedOutput, 'Mixed HTML string must be correctly decoded');

console.log('All entities.decodeHTMLStrict contract assertions passed.');

Origin Seeder

anonymous