CodeSampleX

Пример

is-arrayish 0.2.1: isArrayish

Проверенный пример — npm is-arrayish 0.2.1: isArrayish. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден: isArrayish returns true for…

sha256:b52e48c0d23e187cf39bf53b557644ef7189c5f6bac340b6103a4de55019936c

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. MIT-0

Свидетельства выполнения

Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.

Основа свидетельства
Подписанный контракт пройден
Квитанции проверки
2
Ключи подписи, собравшие его
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-26
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

Кейс

HOW
Цель
verify isArrayish in pkg:npm/is-arrayish@0.2.1
Пакеты
Символы
  • isArrayish
Окружение
node 22.23.2
Создан
2026-08-26T00:58:20Z

Контракт

  1. isArrayish returns true for standard array literals and Array instances
  2. isArrayish returns true for objects with a non-negative length property and a splice function
  3. isArrayish returns false for null, undefined, and falsy primitives
  4. isArrayish returns false for plain objects without length or splice methods
  5. isArrayish returns false for strings and primitive values
  6. isArrayish returns false for objects where length is negative or splice is not a function

Файлы

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

Скачать артефакт с исходным кодом (tar.gz)

Исходный код

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 isArrayish in pkg:npm/is-arrayish@0.2.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/is-arrayish@0.2.1
Demonstrate these symbols/APIs:
  - isArrayish
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:20beb4625af8af4843a41a8f38dc5aa40b9d8123e6bb9979c89fc34af7f5af1f","constraints":{"executionContext":"node"},"contract":["isArrayish returns true for standard array literals and Array instances","isArrayish returns true for objects with a non-negative length property and a splice function","isArrayish returns false for null, undefined, and falsy primitives","isArrayish returns false for plain objects without length or splice methods","isArrayish returns false for strings and primitive values","isArrayish returns false for objects where length is negative or splice is not a function"],"goal":"verify isArrayish in pkg:npm/is-arrayish@0.2.1","kind":"HOW","packages":["pkg:npm/is-arrayish@0.2.1"],"schemaVersion":1,"symbols":["isArrayish"]},"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/is-arrayish@0.2.1"],"schemaVersion":1,"subject":"pkg:npm/is-arrayish@0.2.1","symbols":["isArrayish"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-is-arrayish",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-is-arrayish",
      "version": "1.0.0",
      "dependencies": {
        "is-arrayish": "0.2.1"
      }
    },
    "node_modules/is-arrayish": {
      "version": "0.2.1",
      "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
      "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-is-arrayish",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "dependencies": {
    "is-arrayish": "0.2.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify isArrayish in pkg:npm/is-arrayish@0.2.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/is-arrayish@0.2.1"
  ],
  "symbols": [
    "isArrayish"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import isArrayish from 'is-arrayish';

// 1. isArrayish returns true for standard array literals and Array instances
{
  assert.equal(isArrayish([]), true);
  assert.equal(isArrayish([1, 2, 3]), true);
  assert.equal(isArrayish(new Array(5)), true);
}

// 2. isArrayish returns true for objects with a non-negative length property and a splice function
{
  const customArrayish = {
    length: 0,
    splice: function () {},
  };
  assert.equal(isArrayish(customArrayish), true);

  const populatedArrayish = {
    0: 'hello',
    1: 'world',
    length: 2,
    splice: Array.prototype.splice,
  };
  assert.equal(isArrayish(populatedArrayish), true);
}

// 3. isArrayish returns false for null, undefined, and falsy primitives
{
  assert.equal(isArrayish(null), false);
  assert.equal(isArrayish(undefined), false);
  assert.equal(isArrayish(0), false);
  assert.equal(isArrayish(''), false);
  assert.equal(isArrayish(false), false);
  assert.equal(isArrayish(NaN), false);
}

// 4. isArrayish returns false for plain objects without length or splice methods
{
  assert.equal(isArrayish({}), false);
  assert.equal(isArrayish({ a: 1, b: 2 }), false);
  assert.equal(isArrayish({ length: 0 }), false);
  assert.equal(isArrayish({ length: 5 }), false);
  assert.equal(isArrayish({ splice: function () {} }), false);
}

// 5. isArrayish returns false for strings and primitive values
{
  assert.equal(isArrayish('string'), false);
  assert.equal(isArrayish(123), false);
  assert.equal(isArrayish(true), false);
  assert.equal(isArrayish(Symbol('test')), false);
  assert.equal(isArrayish(BigInt(10)), false);
}

// 6. isArrayish returns false for objects where length is negative or splice is not a function
{
  const negativeLength = {
    length: -1,
    splice: function () {},
  };
  assert.equal(isArrayish(negativeLength), false);

  const nonFunctionSplice = {
    length: 2,
    splice: 'not a function',
  };
  assert.equal(isArrayish(nonFunctionSplice), false);
}

Исходный сидер

аноним