{"id":17649034,"url":"https://github.com/daymxn/rbxts-deep-equal","last_synced_at":"2026-01-23T12:56:30.031Z","repository":{"id":256257539,"uuid":"854747909","full_name":"daymxn/rbxts-deep-equal","owner":"daymxn","description":"Recursive comparator for ROBLOX projects.","archived":false,"fork":false,"pushed_at":"2024-10-05T23:25:09.000Z","size":108,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T02:52:07.012Z","etag":null,"topics":["comparator","deep-equal","rbxts","roblox","roblox-ts","typescript","validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daymxn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-09T17:56:03.000Z","updated_at":"2024-10-05T23:24:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c09431e-5198-426c-a020-ca3a88996567","html_url":"https://github.com/daymxn/rbxts-deep-equal","commit_stats":null,"previous_names":["daymxn/rbxts-deep-equal"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daymxn/rbxts-deep-equal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daymxn%2Frbxts-deep-equal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daymxn%2Frbxts-deep-equal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daymxn%2Frbxts-deep-equal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daymxn%2Frbxts-deep-equal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daymxn","download_url":"https://codeload.github.com/daymxn/rbxts-deep-equal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daymxn%2Frbxts-deep-equal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28692439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comparator","deep-equal","rbxts","roblox","roblox-ts","typescript","validation"],"created_at":"2024-10-23T11:23:41.071Z","updated_at":"2026-01-23T12:56:30.019Z","avatar_url":"https://github.com/daymxn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\ndeep-equal\n\u003c/h1\u003e\n\n\u003e Recursive comparator for ROBLOX projects.\n\n\u003cp align=\"left\"\u003e\n\u003ca alt=\"Released version\" href=\"https://www.npmjs.com/package/@rbxts/deep-equal\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/v/%40rbxts%2Fdeep-equal?style=flat-square\"\u003e\u003c/a\u003e\n\u003cimg alt=\"Last release date\" src=\"https://img.shields.io/github/release-date/daymxn/rbxts-deep-equal?label=last%20release\"\u003e\n\u003ca alt=\"Last commit date\" href=\"https://github.com/daymxn/rbxts-deep-equal/commits/main/\"\u003e\n\u003cimg src=\"https://img.shields.io/github/last-commit/daymxn/rbxts-deep-equal/main?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca alt=\"Open issues\" href=\"https://github.com/daymxn/rbxts-deep-equal/issues\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues/daymxn/rbxts-deep-equal?style=flat-square\"\u003e\u003c/a\u003e\n\u003cimg alt=\"Code size\" src=\"https://img.shields.io/github/languages/code-size/daymxn/rbxts-deep-equal?style=flat-square\"\u003e\n\u003ca alt=\"License\" href=\"https://github.com/daymxn/rbxts-deep-equal/blob/main/LICENSE\"\u003e\n\u003cimg src=\"https://img.shields.io/github/license/daymxn/rbxts-deep-equal?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003cbr\u003e\n\n## Demo\n\n```ts\nimport { deepEqual } from \"@rbxts/deep-equal\";\n\nconst result = deepEqual([1,2,3], [1,2,4]);\nwarn(result);\n```\n\n![ROBLOX console output](./static/demo-output.png)\n\n## Installation\n\nInstall `deep-equal` with your preferred package manager.\n\n### npm\n\n```sh\nnpm install @rbxts/deep-equal\n```\n\n### pnpm\n\n```sh\npnpm add @rbxts/deep-equal\n```\n\n### yarn\n\n```sh\nyarn add @rbxts/deep-equal\n```\n\n## Overview\n\n**deep-equal** is an implementation of the common recrusive comparator, but for roblox projects.\n\nSince roblox `tables` are typically compared by reference, utilizing **deep-equal** allows you\nto compare them by nested values, and get _specific_ failure data on where the comparison failed.\n\n**deep-equal** is also able to differentiate between arrays and non-array tables, so your\ncomparisons on two arrays can be more array specific.\n\n\u003e [!NOTE]\n\u003e **deep-equal** is built to primarily be used as an implementor of deep equal\n\u003e algorithms for _other_ assertion libraries, or more complex validation systems.\n\u003e\n\u003e That's why failures return an object of _specific_ failure data, instead of throwing\n\u003e an error.\n\n## Usage\n\n### Basic Usage\n\n#### Common Types\n\n##### Strings\n\n```ts\ndeepEqual(\"daymon\", \"michael\");\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: \"daymon\",\n *   rightValue: \"michael\"\n * }\n */\n```\n\n##### Numbers\n\n```ts\ndeepEqual(5, 10);\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: 5,\n *   rightValue: 10\n * }\n */\n```\n\n##### Booleans\n\n```ts\ndeepEqual(true, false);\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: true,\n *   rightValue: false\n * }\n */\n```\n\n##### Different Types\n\n```ts\ndeepEqual(5, \"5\");\n/**\n * {\n *   failType: FailureType.DIFFERENT_TYPES,\n *   leftValue: 5,\n *   leftType: \"number\",\n *   rightValue: \"5\",\n *   rightType: \"string\"\n * }\n */\n```\n\n#### Arrays\n\n```ts\ndeepEqual([1,2,3], [1,2,4]);\n/**\n * {\n *   failType: FailureType.MISSING_ARRAY_VALUE,\n *   leftValue: [1,2,3],\n *   rightValue: [1,2,4],\n *   leftMissing: [4],\n *   rightMissing: [3]\n * }\n */\n```\n\n#### Tables\n\n##### Different Property Values\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  age: 100\n}, {\n  name: \"daymon\",\n  age: 200\n});\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: 100,\n *   rightValue: 200,\n *   path: \"age\"\n * }\n */\n```\n\n##### Missing Array Values\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  cars: [\"Tesla\", \"Civic\"]\n}, {\n  name: \"daymon\",\n  cars: [\"Tesla\"]\n});\n/**\n * {\n *   failType: FailureType.MISSING_ARRAY_VALUE,\n *   leftValue: [\"Tesla\", \"Civic\"],\n *   rightValue: [\"Tesla\"],\n *   rightMissing: [\"Civic\"],\n *   path: \"cars\"\n * }\n */\n```\n\n##### Missing Properties\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  age: 100\n}, {\n  name: \"daymon\",\n});\n/**\n * {\n *   failType: FailureType.MISSING,\n *   leftValue: 100,\n *   rightValue: undefined,\n *   path: \"age\"\n * }\n */\n```\n\n##### Nested Tables\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  details: {\n    origin: {\n      city: \"Kansas City\",\n      state: \"MO\"\n    }\n  }\n}, {\n  name: \"daymon\",\n  details: {\n    origin: {\n      city: \"Kansas City\",\n      state: \"KS\"\n    }\n  }\n});\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: \"MO\",\n *   rightValue: \"KS\",\n *   path: \"details.origin.state\"\n * }\n */\n```\n\n#### Roblox Types\n\nRoblox types can be split into two categories: ones that are compared by _value_\nand ones that are compared by _reference_.\n\n##### Value Types\n\n```ts\ndeepEqual(new Vector3(1,2,3), new Vector3(1,2,3)); // pass\n\ndeepEqual(new Vector3(1,2,3), new Vector3(2,4,6));\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: (1, 2, 3),\n *   rightValue: (2, 4, 6)\n * }\n */\n```\n\n##### Reference Types\n\n\u003e [!TIP]\n\u003e You can provide [custom comparators](#custom-comparators) for comparing reference types.\n\n```ts\ndeepEqual(new OverlapParams(), new OverlapParams());\n/**\n * {\n *   failType: FailureType.DIFFERENT_REFERENCE,\n *   leftValue: \"OverlapParams{...}\",\n *   rightValue: \"OverlapParams{...}\"\n * }\n */\n```\n\n### Configuration\n\nYou can optionally provide some configuration in your\ncalls to **deep-equal**, or set them at the [global level](#setting-global-configuration).\n\n#### Ignoring Types\n\nAn array of types to ignore.\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  position: new Vector3(1,2,3),\n  cars: [\"Tesla\", \"Civic\"]\n}, {\n  name: \"daymon\",\n  position: new Vector3(2,4,6),\n  cars: [\"Tesla\"]\n}, { ignore: [\"Vector3\"] });\n/**\n * {\n *   failType: FailureType.MISSING_ARRAY_VALUE,\n *   leftValue: [\"Tesla\", \"Civic\"],\n *   rightValue: [\"Tesla\"],\n *   rightMissing: [\"Civic\"],\n *   path: \"cars\"\n * }\n */\n```\n\nWhen the `left` or `right` is any of these types,\nit will be skipped; effectively \"ignoring\" it for the\npurposes of checking if two objects are equal.\n\n#### Reference Only\n\nAn array of types to only compare by reference.\n\n```ts\ndeepEqual(new Vector3(1,2,3), new Vector3(2,4,6), { referenceOnly: [\"Vector3\"] });\n/**\n * {\n *   failType: FailureType.DIFFERENT_REFERENCE,\n *   leftValue: (1, 2, 3),\n *   rightValue: (2, 4, 6)\n * }\n */\n```\n\nSome roblox types are compared by value instead of reference. Adding\nsaid types to this array will instead force them to be compared by reference instead, with a `FailureType.DIFFERENT_REFERENCE`\nfailure type attached.\n\n#### Check Right Missing\n\nCheck for missing values from the right in comparison to the left.\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  cars: [\"Tesla\", \"Civic\"]\n}, {\n  name: \"daymon\",\n  cars: [\"Tesla\", \"Mustang\"]\n}, { rightMissing: true });\n/**\n * {\n *   failType: FailureType.MISSING_ARRAY_VALUE,\n *   leftValue: [\"Tesla\", \"Civic\"],\n *   rightValue: [\"Tesla\", \"Mustang\"],\n *   leftMissing: [\"Mustang\"]\n *   rightMissing: [\"Civic\"],\n *   path: \"cars\"\n * }\n */\n```\n\nSince this setting is enabled by default, its usage is primarily\nfor disabling it when you only want to check certain values- while ignoring others.\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  details: {\n    origin: {\n      city: \"Kansas City\",\n      state: \"MO\"\n    }\n  }\n}, {\n  details: {\n    origin: {\n      state: \"KS\"\n    }\n  }\n}, { rightMissing: false });\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: \"MO\",\n *   rightValue: \"KS\",\n *   path: \"details.origin.state\"\n * }\n */\n```\n\n#### Compare Arrays In-Order\n\nCompares arrays in order instead of by missing.\n\n```ts\ndeepEqual({\n  name: \"daymon\",\n  cars: [\"Tesla\", \"Civic\"]\n}, {\n  name: \"daymon\",\n  cars: [\"Tesla\"]\n});\n/**\n * {\n *   failType: FailureType.DIFFERENT_VALUES,\n *   leftValue: \"Civic\",\n *   rightValue: undefined,\n *   path: \"cars.[1]\"\n * }\n */\n```\n\nBy default, arrays are looked at in their entirety and a\nlist of elements missing from either (depending on if\n`checkRightMissing` is enabled) is provided.\n\nYou can enable `inOrder` to _instead_ throw at the first failure,\nwith data pertaining to _where_ the failure occurred.\n\nUseful when working with arrays of complex types, or when you want to\nassert that an array is \"exactly in order\".\n\n### Custom Comparators\n\nIf you want to provide your own behavior for certain types (like reference\ntypes) or override existing behavior, you can provide your own methods\nfor certain types.\n\n```ts\nconst checkInstance: CustomChecker\u003c\"Instance\"\u003e = (config, left, right) =\u003e {\n  if(left.Name === right.Name) return Option.none();\n  return return Option.some({\n    failType: FailureType.DIFFERENT_VALUES,\n    leftValue: left.Name,\n    rightValue: right.Name,\n    leftMissing: [],\n    rightMissing: [],\n    leftType: \"Instance\",\n    rightType: \"Instance\",\n    path: \"\",\n  });\n};\n\ndeepEqual(Workspace.Part1, Workspace.Part2, {\n  customCheckers: {\n    Instance: checkInstance\n  }\n});\n```\n\n\u003e ![TIP]\n\u003e By default, **deep-equal** provides some\n\u003e checkers for certain reference types out of the box\n\u003e that are already attached to the default config!\n\u003e\n\u003e Take a look at the [checkers directory](https://github.com/daymxn/rbxt-deep-equal/tree/main/src/checkers)\n\u003e to see which types, and further examples of custom comparators.\n\n### Setting Global Configuration\n\nIf you have configurations you want to apply to all usages of **deep-equal**,\nyou can set a global configuration.\n\n```ts\nsetDefaultDeepEqualConfig({\n  customCheckers: {\n    Instance: checkInstance\n  }\n});\n\ndeepEqual(Workspace.Part1, Workspace.Part2); // inherits the default config\n```\n\n\u003e [!WARNING]\n\u003e `setDefaultDeepEqualConfig` _replaces_ any previously set\n\u003e default config- it does _not_ merge them.\n\u003e\n\u003e You can use the provided `getDefaultDeepEqualConfig` and\n\u003e `mergeConfigs` functions to add this behavior on your own, but\n\u003e the default config is not intended to be used in such a way-\n\u003e which is why this behavior is not provided out of the box.\n\n## Roadmap\n\n- Provide better circular reference identification in the failure data.\n- Provide a support library for deep `Instance` comparators.\n- Implement workflow for test coverage.\n- Implement tests for provided comparators.\n- Add workflow for checking API diff and version bumping according to semver.\n- Add note in contributing about checking the api diff.\n\n## Contributing\n\nIf you're interested in contributing to **deep-equal**, give the [CONTRIBUTING](CONTRIBUTING.md) doc a read.\n\n## License\n\n[Apache 2.0](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaymxn%2Frbxts-deep-equal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaymxn%2Frbxts-deep-equal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaymxn%2Frbxts-deep-equal/lists"}