{"id":21384605,"url":"https://github.com/jashgopani/react-ref-compare","last_synced_at":"2026-05-07T12:31:10.112Z","repository":{"id":57343378,"uuid":"364504684","full_name":"jashgopani/react-ref-compare","owner":"jashgopani","description":"A little package for comparing react refs with other refs or DOM elements.","archived":false,"fork":false,"pushed_at":"2021-05-28T06:49:52.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T18:38:56.749Z","etag":null,"topics":["compare","dom-elements","javascript","library","npm","npm-install","npm-package","react","react-dom","react-ref","reactjs","stringify","tiny","utility","utility-library"],"latest_commit_sha":null,"homepage":"http://jashgopani.me/react-ref-compare","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/jashgopani.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}},"created_at":"2021-05-05T08:09:11.000Z","updated_at":"2021-05-28T06:49:55.000Z","dependencies_parsed_at":"2022-09-12T06:30:35.713Z","dependency_job_id":null,"html_url":"https://github.com/jashgopani/react-ref-compare","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jashgopani/react-ref-compare","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jashgopani%2Freact-ref-compare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jashgopani%2Freact-ref-compare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jashgopani%2Freact-ref-compare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jashgopani%2Freact-ref-compare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jashgopani","download_url":"https://codeload.github.com/jashgopani/react-ref-compare/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jashgopani%2Freact-ref-compare/sbom","scorecard":{"id":506993,"data":{"date":"2025-08-11","repo":{"name":"github.com/jashgopani/react-ref-compare","commit":"050f67e023f7cd72b411bda70df8db597ceae188"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T23:28:27.671Z","repository_id":57343378,"created_at":"2025-08-19T23:28:27.671Z","updated_at":"2025-08-19T23:28:27.671Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32737615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"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":["compare","dom-elements","javascript","library","npm","npm-install","npm-package","react","react-dom","react-ref","reactjs","stringify","tiny","utility","utility-library"],"created_at":"2024-11-22T11:42:13.558Z","updated_at":"2026-05-07T12:31:10.092Z","avatar_url":"https://github.com/jashgopani.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-ref-compare\n\nA simple utility for comparing refs in React.js with either refs or DOM Elements.\n\n[![GitHub issues](https://img.shields.io/github/issues/jashgopani/react-ref-compare)](https://github.com/jashgopani/react-ref-compare/issues) [![GitHub forks](https://img.shields.io/github/forks/jashgopani/react-ref-compare)](https://github.com/jashgopani/react-ref-compare/network) [![GitHub stars](https://img.shields.io/github/stars/jashgopani/react-ref-compare)](https://github.com/jashgopani/react-ref-compare/stargazers)\n\n## Table of Contents\n- [Features](#features)\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n- [Usage](#usage)\n  - [1. compareRef ( object1, object2 )](#1-compareref--object1-object2-)\n  - [2. stringify ( Object )](#2-stringify--object-)\n\n## Features\n- Compare DOM and Virtual DOM elements by comparing `ref` with `ref` or with `DOM Element`.\n- Get a unique String representation of the `DOM Element` or `ref` Object.\n  \n## Installation\n\n```\nnpm i react-ref-compare\n```\n\n## Getting Started\n\n```javascript\nimport compareRef, { stringify } from \"react-ref-compare\";\n```\n\n## Usage\n\n### 1. compareRef ( object1, object2 )\n\nUse this method to compare two objects where each object is either a react `ref` or a `DOM Element`.\nThis method returns `boolean` value.\n\n\u003e **Note:** You cannot compare refs that are not of DOM or Virtual DOM elements\n\n```javascript\nimport compareRef, { stringify } from \"react-ref-compare\";\nfunction CustomTextInput(props) {\n  const ref1 = useRef(null);\n  const ref2 = useRef(null);\n  const ref3 = useRef(3);\n\n  function handleClick(e) {\n    //comparing ref with ref\n    if (compareRef(ref1, ref2)) {\n      //do something\n    }\n\n    //comparing ref with domElement\n    const domElement = document.elementFromPoint(e.clientX, e.clientY);\n    if (compareRef(ref1, domElement)) {\n      //do something\n    }\n\n    //invalid usage\n    compareRef(ref1, ref3);\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cinput type=\"text\" ref={ref1} /\u003e\n      \u003cinput\n        type=\"button\"\n        value=\"Focus the text input\"\n        ref={ref2}\n        onClick={handleClick}\n      /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### 2. stringify ( Object )\n\nThis method returns a `String` that can be used to identify a DOM / Virtual DOM element. This type of string can be seen when you log elements in console.\nThis returns a string of the format\n\n```javascript\n//dom element\n\u003cdiv id=\"container\" class=\"container-fluid outer-box\"\u003eSome content\u003c/div\u003e;\n\n//stringify output -\u003e tagName#id.className\ndiv#container.container-fluid outer-box;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjashgopani%2Freact-ref-compare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjashgopani%2Freact-ref-compare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjashgopani%2Freact-ref-compare/lists"}