{"id":22061692,"url":"https://github.com/floofies/js-testdiff","last_synced_at":"2025-10-10T05:03:30.174Z","repository":{"id":153897397,"uuid":"630913348","full_name":"Floofies/js-testdiff","owner":"Floofies","description":"The deep diff/test function from Differentia.js, ported to TypeScript. Returns true if input 1 differs in any way from input 2. Performs deep object traversal by default, works OK with circular references.","archived":false,"fork":false,"pushed_at":"2023-12-22T22:09:49.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T02:07:26.564Z","etag":null,"topics":["diff-objects","javascript-object","json-diff","object-comparison","object-diff","object-oriented"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Floofies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2023-04-21T12:57:46.000Z","updated_at":"2024-03-29T10:01:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"697d84cb-f6ab-46a0-8de7-2fbf98ba3857","html_url":"https://github.com/Floofies/js-testdiff","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Floofies/js-testdiff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2Fjs-testdiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2Fjs-testdiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2Fjs-testdiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2Fjs-testdiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Floofies","download_url":"https://codeload.github.com/Floofies/js-testdiff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2Fjs-testdiff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261789274,"owners_count":23209775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["diff-objects","javascript-object","json-diff","object-comparison","object-diff","object-oriented"],"created_at":"2024-11-30T18:14:06.111Z","updated_at":"2025-10-10T05:03:30.081Z","avatar_url":"https://github.com/Floofies.png","language":"JavaScript","readme":"# js-testDiff\n\n[![NPM](https://nodei.co/npm/js-testdiff.png?compact=true)](https://www.npmjs.com/package/js-testdiff)\n\n- [About](#about)\n- [Building](#building)\n- [Syntax](#syntax)\n- [Usage Examples](#usage-examples)\n\n## About\n\nDeep object diffing function for JavaScript; returns true if input 1 differs in any way from input 2. Original code was taken from Differentia.js and ported to TypeScript.\n\nThe testDiff function was originally created as a unit testing utility and it was primarily designed/used to test Differentia's search algorithm strategy system, setting a \"gold standard\" for that library's quality and algorithmic correctness.\n\nThe key difference with this version of testDiff is that I removed its \"search index\" functionality, as it introduced more complexity than it was worth.\n\nFeel free to scavenge the original code as I have: https://github.com/Floofies/Differentia.js/blob/master/spec/testUtils.js\n\n## Building\n\nRun `npm run build` to compile and test module `dist/index.js`.\n\nI have pre-compiled the most up-to-date files in `dist`. Enjoy.\n\n`unitTest.js` can be safely ignored, as it's a development-only dependency for `test.mjs`.\n\n## Syntax\n\n```JavaScript\nimport { testDiff } from \"testDiff\";\n```\n```JavaScript\ntestDiff( input1:any, input2:any, [ deep:boolean = false ] );\n```\n\n### Parameters:\n\n#### `input1`, `input2`\n\nTwo values/objects to compare against each other.\n\n#### `deep` (_Optional_) (_Default = `true`_)\n\nTestDiff performs \"deep\" object/array traversal by default, comparing all reachable values; set this operand to `false` to disable traversal and nested comparisons.\n\n### Return Value:\n\nReturns `true` if `input1`'s structure, properties, or values differ in any way from `input2`, or `false` if otherwsie.\n\n## Usage Examples\n\n### Example 1: Arbitrary values.\n\nCan handle any arbitrary values, as well as objects/arrays.\n\n```JavaScript\nconst myArray1 = \"Hello World!\";\nconst myArray2 = \"This is a test\";\nconst result = testDiff(myArray1, myArray2);\n// result = true\n```\n\n### Example 2: Flat arrays/objects.\n\n```JavaScript\nconst myArray1 = [1,2,3];\nconst myArray2 = [4,5,6];\nconst result = testDiff(myArray1, myArray2);\n// result = true\n```\n\n### Example 3: Nested arrays/objects.\n\n```JavaScript\nconst myArray1 = [\"Hello\",[\"World!\"]];\nconst myArray2 = [\"Hello\",[\"Developer!\"]];\nconst result = testDiff(myArray1, myArray2);\n// result = true\n```\n\n### Example 4: Nested arrays. Traversal disabled.\n\nIn this example, the function returns `false` even though the arrays' contents differ; they are regarded as the same because there are no differences at the top, and disabling traversal prevents the algorithm from seeing deeper differences.\n\n```JavaScript\nconst myArray1 = [\"Hello\",[\"World!\"]];\nconst myArray2 = [\"Hello\",[\"Developer!\"]];\nconst result = testDiff(myArray1, myArray2, false);\n// result = false\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloofies%2Fjs-testdiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloofies%2Fjs-testdiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloofies%2Fjs-testdiff/lists"}