{"id":21565150,"url":"https://github.com/cfware/instanceof-unifier","last_synced_at":"2025-09-08T22:35:54.100Z","repository":{"id":57144646,"uuid":"216717996","full_name":"cfware/instanceof-unifier","owner":"cfware","description":"Allow `instanceof` to match even if comparing an instance created by a different copy of the class","archived":false,"fork":false,"pushed_at":"2019-10-22T15:57:34.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T06:30:28.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cfware.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":"2019-10-22T03:44:25.000Z","updated_at":"2019-10-22T04:26:36.000Z","dependencies_parsed_at":"2022-09-05T18:51:29.336Z","dependency_job_id":null,"html_url":"https://github.com/cfware/instanceof-unifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cfware/instanceof-unifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Finstanceof-unifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Finstanceof-unifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Finstanceof-unifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Finstanceof-unifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfware","download_url":"https://codeload.github.com/cfware/instanceof-unifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfware%2Finstanceof-unifier/sbom","scorecard":{"id":272221,"data":{"date":"2025-08-11","repo":{"name":"github.com/cfware/instanceof-unifier","commit":"b1a1d0d0afda734ac4be72ebefd3bc302a42393f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/4 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":"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":"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":"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":"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":"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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/cfware/.github/SECURITY.md:1","Info: Found linked content: github.com/cfware/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/cfware/.github/SECURITY.md:1","Info: Found text in security policy: github.com/cfware/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}}]},"last_synced_at":"2025-08-17T13:39:58.801Z","repository_id":57144646,"created_at":"2025-08-17T13:39:58.801Z","updated_at":"2025-08-17T13:39:58.801Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231417,"owners_count":25245659,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-24T10:18:35.572Z","updated_at":"2025-09-08T22:35:54.078Z","avatar_url":"https://github.com/cfware.png","language":"JavaScript","readme":"# instanceof-unifier\n\n[![Travis CI][travis-image]][travis-url]\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![MIT][license-image]](LICENSE)\n\nAllow `instanceof` to match even if comparing an instance created by a different\ncopy of the class.  This module requires node.js 6.5.0 or above to function.\n\n## instanceofUnifier(Class, matcher)\n\nCalling this function makes alterations to the way `instanceof` works on `Class`.\n`matcher` must be a `string`.\n\nThe user is responsible for picking a unique matcher name.  It is recommended to use\n`\u003cmodule-name\u003e@\u003cversion\u003e:package-local-id`.  Version does not have to match the package\nversion but it is important to increment it any time a version update is not compatible\nwith previous versions.\n\n\n## Example Usage\n\nCreate an ESM module:\n```js\n// index.mjs\nimport instanceofUnifier from 'instanceof-unifier';\n\nexport class MyClass {\n}\n\ninstanceofUnifier(MyClass, 'my-package-name@1.0.0:MyClass');\n```\n\nTranspile to Commonjs (babel output shown):\n```js\n// index.cjs\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.MyClass = void 0;\n\nvar _instanceofUnifier = _interopRequireDefault(require(\"instanceof-unifier\"));\n\nfunction _interopRequireDefault(obj) { return obj \u0026\u0026 obj.__esModule ? obj : { default: obj }; }\n\nclass MyClass {}\n\nexports.MyClass = MyClass;\n(0, _instanceofUnifier.default)(MyClass, 'my-package-name@1.0.0:MyClass');\n```\n\nThis avoids the divergent specifier hazard for `instanceof`.  You can test:\n```js\nimport indexCJS from './index.cjs';\nimport {MyClass as ESM} from './index.mjs';\n\nconst CJS = indexCJS.MyClass;\n\nconst cjs = new CJS();\nconst esm = new ESM();\n\nif (cjs instanceof CJS \u0026\u0026 cjs instanceof ESM) {\n\tconsole.log('cjs is instanceof both classes');\n}\n\nif (esm instanceof CJS \u0026\u0026 esm instanceof ESM) {\n\tconsole.log('esm is instanceof both classes');\n}\n```\n\nIn addition to the divergent specifier hazard this also ensures `instanceof` matches\nbetween multiple copies of your module.\n\n\n[npm-image]: https://img.shields.io/npm/v/instanceof-unifier.svg\n[npm-url]: https://npmjs.org/package/instanceof-unifier\n[travis-image]: https://travis-ci.org/cfware/instanceof-unifier.svg?branch=master\n[travis-url]: https://travis-ci.org/cfware/instanceof-unifier\n[downloads-image]: https://img.shields.io/npm/dm/instanceof-unifier.svg\n[downloads-url]: https://npmjs.org/package/instanceof-unifier\n[license-image]: https://img.shields.io/npm/l/instanceof-unifier.svg\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfware%2Finstanceof-unifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfware%2Finstanceof-unifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfware%2Finstanceof-unifier/lists"}