CodeSampleX

Beispiel

@vue/shared 3.5.41: looseEqual, normalizeClass, normalizeStyle

Verifiziertes Beispiel für npm @vue/shared 3.5.41: looseEqual, normalizeClass, normalizeStyle. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und…

sha256:aee49d988b961d9053602ebcc4afa031326c67f0c3c67162bc02147d0556dcf8

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

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 normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41
Pakete
Symbole
  • looseEqual
  • normalizeClass
  • normalizeStyle
Erstellt
2026-08-27T15:50:43Z

Contract

  1. normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names
  2. normalizeClass recursively normalizes nested array and object structures and ignores falsy values
  3. parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects
  4. normalizeStyle preserves string styles, passes object styles, and merges array of styles
  5. looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects
  6. looseIndexOf finds element index in array using looseEqual semantics

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • 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 normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40vue/shared@3.5.41
Demonstrate these symbols/APIs:
  - looseEqual
  - normalizeClass
  - normalizeStyle

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:c65fe754abaab836da3f15d1687e27c4317b07c63d87987076a02866e7012979","contract":["normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names","normalizeClass recursively normalizes nested array and object structures and ignores falsy values","parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects","normalizeStyle preserves string styles, passes object styles, and merges array of styles","looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects","looseIndexOf finds element index in array using looseEqual semantics"],"goal":"verify normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41","kind":"HOW","packages":["pkg:npm/%40vue/shared@3.5.41"],"schemaVersion":1,"symbols":["looseEqual","normalizeClass","normalizeStyle"]},"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/%40vue/shared@3.5.41"],"schemaVersion":1,"subject":"pkg:npm/%40vue/shared@3.5.41","symbols":["looseEqual","normalizeClass","normalizeStyle"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-vue-shared",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-vue-shared",
      "version": "1.0.0",
      "dependencies": {
        "@vue/shared": "3.5.41"
      }
    },
    "node_modules/@vue/shared": {
      "version": "3.5.41",
      "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.41.tgz",
      "integrity": "sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-vue-shared",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "@vue/shared": "3.5.41"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify normalizeClass, normalizeStyle, and looseEqual in pkg:npm/%40vue/shared@3.5.41",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40vue/shared@3.5.41"
  ],
  "symbols": [
    "looseEqual",
    "normalizeClass",
    "normalizeStyle"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import {
  normalizeClass,
  normalizeStyle,
  parseStringStyle,
  stringifyStyle,
  looseEqual,
  looseIndexOf
} from '@vue/shared';

// 1. normalizeClass flattens strings, string arrays, and object truthy boolean keys into space-separated class names
{
  assert.equal(normalizeClass('foo bar'), 'foo bar');
  assert.equal(normalizeClass(['foo', 'bar']), 'foo bar');
  assert.equal(normalizeClass({ foo: true, bar: false, baz: 1 }), 'foo baz');
}

// 2. normalizeClass recursively normalizes nested array and object structures and ignores falsy values
{
  assert.equal(
    normalizeClass(['foo', { bar: true, baz: false }, ['nested', { inner: true }], null, undefined, false]),
    'foo bar nested inner'
  );
  assert.equal(normalizeClass(null), '');
  assert.equal(normalizeClass(undefined), '');
  assert.equal(normalizeClass(false), '');
}

// 3. parseStringStyle converts css text into key-value style map and stringifyStyle serializes style objects
{
  assert.deepEqual(parseStringStyle('color: red; font-size: 14px;'), {
    color: 'red',
    'font-size': '14px'
  });
  assert.deepEqual(parseStringStyle('margin-top: 10px; opacity: 0.5;'), {
    'margin-top': '10px',
    opacity: '0.5'
  });
  assert.equal(stringifyStyle({ color: 'red', fontSize: '14px' }), 'color:red;font-size:14px;');
}

// 4. normalizeStyle preserves string styles, passes object styles, and merges array of styles
{
  assert.equal(normalizeStyle('color: red; font-size: 14px;'), 'color: red; font-size: 14px;');
  assert.deepEqual(normalizeStyle({ color: 'red', fontSize: '14px' }), {
    color: 'red',
    fontSize: '14px'
  });

  const merged = normalizeStyle([
    'color: red;',
    { fontSize: '12px' },
    { color: 'blue', fontWeight: 'bold' }
  ]);
  assert.deepEqual(merged, {
    color: 'blue',
    fontSize: '12px',
    fontWeight: 'bold'
  });
}

// 5. looseEqual performs deep structural equality comparison across primitives, dates, regexes, arrays, and objects
{
  assert.equal(looseEqual(1, 1), true);
  assert.equal(looseEqual('1', 1), true);
  assert.equal(looseEqual(new Date(1600000000000), new Date(1600000000000)), true);
  assert.equal(looseEqual(new Date(1600000000000), new Date(1700000000000)), false);
  assert.equal(looseEqual(/abc/g, /abc/g), true);
  assert.equal(looseEqual(/abc/g, /abc/i), false);
  assert.equal(looseEqual([1, 2, 3], [1, 2, 3]), true);
  assert.equal(looseEqual([1, 2], [1, 2, 3]), false);
  assert.equal(looseEqual({ a: 1, b: '2' }, { b: 2, a: 1 }), true);
}

// 6. looseIndexOf finds element index in array using looseEqual semantics
{
  const list = [1, { id: 1 }, { id: 2 }];
  assert.equal(looseIndexOf(list, { id: 1 }), 1);
  assert.equal(looseIndexOf(list, { id: 2 }), 2);
  assert.equal(looseIndexOf(list, { id: 3 }), -1);
}

Ursprungs-Seeder

anonym