{"id":20614401,"url":"https://github.com/aryan-programmer/extend-bases","last_synced_at":"2025-04-15T07:31:33.330Z","repository":{"id":42896206,"uuid":"253400381","full_name":"aryan-programmer/extend-bases","owner":"aryan-programmer","description":"extend-bases","archived":false,"fork":false,"pushed_at":"2023-03-04T10:32:18.000Z","size":513,"stargazers_count":2,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T17:57:21.261Z","etag":null,"topics":["inheritance","javascript","javascript-library","js","multiple-inheritance","npm","npm-module","npm-package","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aryan-programmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-04-06T05:08:33.000Z","updated_at":"2022-11-22T11:48:27.000Z","dependencies_parsed_at":"2024-10-11T15:05:11.897Z","dependency_job_id":"1ff2044f-ba3a-401d-9221-48712f0601a7","html_url":"https://github.com/aryan-programmer/extend-bases","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"0bb3adf1ccf2eca202f4ff46b0a5126d5ae6c997"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryan-programmer%2Fextend-bases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryan-programmer%2Fextend-bases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryan-programmer%2Fextend-bases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aryan-programmer%2Fextend-bases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aryan-programmer","download_url":"https://codeload.github.com/aryan-programmer/extend-bases/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501668,"owners_count":21114676,"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":["inheritance","javascript","javascript-library","js","multiple-inheritance","npm","npm-module","npm-package","ts","typescript"],"created_at":"2024-11-16T11:12:38.108Z","updated_at":"2025-04-15T07:31:33.301Z","avatar_url":"https://github.com/aryan-programmer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# extend-bases: A simple library for multiple inheritance in JavaScript.\n\nThis library can be used to achieve multiple inheritance in JavaScript, but it sets itself apart from other libraries\nfor multiple inheritance because it isolates the base classes and prevents the properties and methods from colliding,\nwhile still allowing easy access to the properties and methods of the base classes.\n\n## Installation\n\nSimply run:\n\n```\nnpm add extend-bases\n```\n\nOr:\n\n```\nyarn add extend-bases\n```\n\nTo import:\n\n```typescript\nimport {bases, defineProperties, isInstanceOf} from \"extend-bases\";\n```\n\nOr:\n\n```typescript\nconst {bases, defineProperties, isInstanceOf} = require(\"extend-bases\");\n```\n\n## Getting started\n\nTo inherit from multiple bases simply extend from `bases(Class1, Class2, ...)`. In the constructor pass the \u003cb\u003e*\ninstances*\u003c/b\u003e of the classes to the `super` constructor.\n\nThen you can access the base properties and methods directly from `this.`, the first class with that property or method\nwill be given precedence.\n\nTo access a particular base use `this.bases[index]`.\n\nReplace all instances of `v instanceof Class` with `isInstanceOf(v, Class)`, it’s just that simple.\n\n## For more details\n\n- Read the [Handy manual](https://github.com/aryan-programmer/extend-bases/wiki/Handy-Manual), it’s very simple \u0026 small\n  and gives enough information to get started.\n- Then read the [Documentation](https://github.com/aryan-programmer/extend-bases/wiki/Documentation). it’s not too big\n  and easy to go through.\n- Then, if you have enough time or are interested, read the tests and source code of the project.\n\n## Implementation details\n\nThis library uses Proxies, so sadly no IE11 support, but otherwise this library also imports es-shims\nfor `Reflect.ownKeys`(ES6 but used very often and an es-shim exists for it) and `Array.prototype.flatMap`(ES2019, very\nnew), which were found to be the bottlenecks, for some browsers.\n\nThis library uses proxies for easy access in the class instances, and it merges the prototypes of the base classes, but\nfor isolation of base classes it creates a new function wrapping the method call. It’s just best to look at the source\ncode for this.\n\n## TypeScript support\n\nThe library is by default written in TypeScript, which you all should be using if you aren’t, for great code completion.\nThe details of the TypeScript definitions are a bit fiddly, so it’s best not to worry about them, they work\u003csmall\u003e, or\nyou can just look at the source code\u003c/small\u003e.\n\n## Contributing\n\nFeel free to open a pull request, fix bugs, or read the source code. It’s all up to you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryan-programmer%2Fextend-bases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faryan-programmer%2Fextend-bases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faryan-programmer%2Fextend-bases/lists"}