{"id":22021603,"url":"https://github.com/lamansky/is-subclass-of","last_synced_at":"2026-04-10T01:10:55.042Z","repository":{"id":57277609,"uuid":"128957112","full_name":"lamansky/is-subclass-of","owner":"lamansky","description":"[Node.js] Returns true if A is a subclass of B.","archived":false,"fork":false,"pushed_at":"2018-04-10T15:40:54.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T21:37:52.205Z","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-10T15:39:47.000Z","updated_at":"2018-04-10T15:40:56.000Z","dependencies_parsed_at":"2022-09-11T19:50:35.251Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/is-subclass-of","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fis-subclass-of","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fis-subclass-of/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fis-subclass-of/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fis-subclass-of/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/is-subclass-of/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245085131,"owners_count":20558340,"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":[],"created_at":"2024-11-30T06:13:12.679Z","updated_at":"2025-12-30T23:35:06.245Z","avatar_url":"https://github.com/lamansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-subclass-of\n\nReturns true if A is a subclass of B.\n\n## Installation\n\nRequires [Node.js](https://nodejs.org/) 6.0.0 or above.\n\n```bash\nnpm i is-subclass-of\n```\n\n## API\n\nThe module exports a single function.\n\n### Parameters\n\n1. Bindable: `A` (function): What may or may not be a subclass of B.\n2. `B` (function or string): What may or may not be an ancestor of A. You can either provide the class itself or its string name.\n\n### Return Value\n\n* Returns `true` if `A` is a subclass of `B`.\n* Otherwise `false`.\n\n## Example\n\n```javascript\nconst isSubclassOf = require('is-subclass-of')\n\nisSubclassOf(Date, Error) // false\nisSubclassOf(Error, Error) // false\n\nisSubclassOf(TypeError, Error) // true\nisSubclassOf(RangeError, Error) // true\nisSubclassOf(RangeError, 'Error') // true\n\nclass A {}\nclass B extends A {}\nisSubclassOf(A, A) // false\nisSubclassOf(B, A) // true\nisSubclassOf(B, 'A') // true\n\n// Supports the bind operator\nTypeError::isSubclassOf(Error) // true\nTypeError::isSubclassOf('Error') // true\nB::isSubclassOf(A) // true\n```\n\n## Related\n\n* [is-class-of](https://github.com/lamansky/is-class-of): Returns true if A is a subclass of B or the same class as B.\n* [is-instance-of](https://github.com/lamansky/is-instance-of): Like `instanceof`, but uses class name strings.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fis-subclass-of","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fis-subclass-of","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fis-subclass-of/lists"}