샘플
lodash.isequal 4.5.0: deep comparison with lodash.isequal
검증된 샘플 — npm lodash.isequal 4.5.0: deep comparison with lodash.isequal. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:444f6d2b34eb867bd162812ad26c6afe131826ffdf899289763cce25f3712501
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-28 |
케이스
HOW- 목표
- deep comparison with lodash.isequal
- 심벌
-
- isEqual
- 생성일
- 2026-08-28T05:00:50Z
컨트랙트
- isEqual returns true for equivalent primitive values including identical strings, numbers, booleans, and NaN
- isEqual performs deep equality comparison between nested plain objects with identical keys and values
- isEqual performs deep equality comparison between arrays of identical order, length, and elements
- isEqual returns true for equivalent Date and RegExp instances with identical internal state
- isEqual returns true for equivalent Map and Set instances with matching entries and values
- isEqual handles circular references without entering infinite recursion
- isEqual returns false for values with different types, differing nested properties, or different array lengths
- isEqual compares functions by reference and treats distinct function instances as not equal
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
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: deep comparison with lodash.isequal
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/lodash.isequal@4.5.0
Demonstrate these symbols/APIs:
- isEqual
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.
{"case":{"caseId":"case:sha256:53e6128b3c66ce3f4a1b5908bd2788533928db8d848c71fa6cb21e69b94a131d","contract":["isEqual returns true for equivalent primitive values including identical strings, numbers, booleans, and NaN","isEqual performs deep equality comparison between nested plain objects with identical keys and values","isEqual performs deep equality comparison between arrays of identical order, length, and elements","isEqual returns true for equivalent Date and RegExp instances with identical internal state","isEqual returns true for equivalent Map and Set instances with matching entries and values","isEqual handles circular references without entering infinite recursion","isEqual returns false for values with different types, differing nested properties, or different array lengths","isEqual compares functions by reference and treats distinct function instances as not equal"],"goal":"deep comparison with lodash.isequal","kind":"HOW","packages":["pkg:npm/lodash.isequal@4.5.0"],"schemaVersion":1,"symbols":["isEqual"]},"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/lodash.isequal@4.5.0"],"schemaVersion":1,"subject":"pkg:npm/lodash.isequal@4.5.0","symbols":["isEqual"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-lodash-isequal",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-lodash-isequal",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"lodash.isequal": "4.5.0"
}
},
"node_modules/lodash.isequal": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
"deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.",
"license": "MIT"
}
}
}
{
"name": "sample-lodash-isequal",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"lodash.isequal": "4.5.0"
}
}
{
"schemaVersion": 1,
"goal": "deep comparison with lodash.isequal",
"kind": "HOW",
"packages": [
"pkg:npm/lodash.isequal@4.5.0"
],
"symbols": [
"isEqual"
]
}
import isEqual from 'lodash.isequal';
/**
* Compare two values deeply to determine if they are equivalent.
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns true if the values are equivalent, else false.
*/
export function areValuesEqual(value, other) {
return isEqual(value, other);
}
/**
* Check if an object matches a subset of expected key-value pairs deeply.
* @param {Record<string, any>} object The target object.
* @param {Record<string, any>} subset The expected subset object.
* @returns {boolean} Returns true if subset matches deeply, else false.
*/
export function matchesSubset(object, subset) {
if (typeof object !== 'object' || object === null) {
return false;
}
return Object.keys(subset).every((key) => isEqual(object[key], subset[key]));
}
/**
* Filter an array of items to return only those deeply equal to a target value.
* @param {Array<any>} items The items to filter.
* @param {*} target The target value to compare against.
* @returns {Array<any>} Filtered items deeply equal to target.
*/
export function filterEqualItems(items, target) {
return items.filter((item) => isEqual(item, target));
}
export { isEqual };
export default isEqual;
import assert from 'node:assert/strict';
import { isEqual, areValuesEqual, matchesSubset, filterEqualItems } from '../src/index.mjs';
// 1. isEqual returns true for equivalent primitive values including identical strings, numbers, booleans, and NaN
{
assert.equal(isEqual(42, 42), true);
assert.equal(isEqual('hello', 'hello'), true);
assert.equal(isEqual(true, true), true);
assert.equal(isEqual(null, null), true);
assert.equal(isEqual(undefined, undefined), true);
assert.equal(isEqual(NaN, NaN), true);
assert.equal(isEqual(+0, -0), true);
assert.equal(areValuesEqual('test', 'test'), true);
}
// 2. isEqual performs deep equality comparison between nested plain objects with identical keys and values
{
const obj1 = {
id: 1,
meta: {
tags: ['a', 'b'],
config: { enabled: true, timeout: 3000 }
}
};
const obj2 = {
id: 1,
meta: {
tags: ['a', 'b'],
config: { enabled: true, timeout: 3000 }
}
};
assert.equal(isEqual(obj1, obj2), true);
assert.equal(matchesSubset(obj1, { id: 1, meta: { tags: ['a', 'b'], config: { enabled: true, timeout: 3000 } } }), true);
}
// 3. isEqual performs deep equality comparison between arrays of identical order, length, and elements
{
const arr1 = [1, [2, { key: 'value' }], 4];
const arr2 = [1, [2, { key: 'value' }], 4];
assert.equal(isEqual(arr1, arr2), true);
const list = [
{ type: 'item', id: 10 },
{ type: 'item', id: 20 },
{ type: 'item', id: 10 }
];
const filtered = filterEqualItems(list, { type: 'item', id: 10 });
assert.equal(filtered.length, 2);
}
// 4. isEqual returns true for equivalent Date and RegExp instances with identical internal state
{
const date1 = new Date('2026-01-01T00:00:00.000Z');
const date2 = new Date('2026-01-01T00:00:00.000Z');
assert.equal(isEqual(date1, date2), true);
const regex1 = /^[a-z]+$/gi;
const regex2 = /^[a-z]+$/gi;
assert.equal(isEqual(regex1, regex2), true);
}
// 5. isEqual returns true for equivalent Map and Set instances with matching entries and values
{
const map1 = new Map([['k1', { val: 1 }], ['k2', { val: 2 }]]);
const map2 = new Map([['k1', { val: 1 }], ['k2', { val: 2 }]]);
assert.equal(isEqual(map1, map2), true);
const set1 = new Set(['x', 'y', 'z']);
const set2 = new Set(['x', 'y', 'z']);
assert.equal(isEqual(set1, set2), true);
}
// 6. isEqual handles circular references without entering infinite recursion
{
const circ1 = { name: 'node' };
circ1.self = circ1;
const circ2 = { name: 'node' };
circ2.self = circ2;
assert.equal(isEqual(circ1, circ2), true);
}
// 7. isEqual returns false for values with different types, differing nested properties, or different array lengths
{
assert.equal(isEqual(42, '42'), false);
assert.equal(isEqual(null, undefined), false);
assert.equal(isEqual({ a: 1, b: 2 }, { a: 1, b: 3 }), false);
assert.equal(isEqual({ a: 1 }, { a: 1, b: 2 }), false);
assert.equal(isEqual([1, 2], [1, 2, 3]), false);
assert.equal(isEqual([1, 2], [2, 1]), false);
assert.equal(isEqual(new Date('2026-01-01'), new Date('2026-01-02')), false);
assert.equal(isEqual(/abc/i, /abc/g), false);
}
// 8. isEqual compares functions by reference and treats distinct function instances as not equal
{
const fn1 = () => 1;
const fn2 = () => 1;
assert.equal(isEqual(fn1, fn1), true);
assert.equal(isEqual(fn1, fn2), false);
}
console.log('Contract assertions passed.');
오리진 시더
익명