{"id":19238211,"url":"https://github.com/olical/heir","last_synced_at":"2025-12-12T03:58:52.196Z","repository":{"id":4439966,"uuid":"5578267","full_name":"Olical/Heir","owner":"Olical","description":"Helper functions for prototypical inheritance in JavaScript","archived":false,"fork":false,"pushed_at":"2018-04-20T13:14:27.000Z","size":84,"stargazers_count":61,"open_issues_count":0,"forks_count":9,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-08T15:48:28.513Z","etag":null,"topics":["classes","inheritance","javascript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/heir","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Olical.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-27T23:11:17.000Z","updated_at":"2025-04-03T15:31:02.000Z","dependencies_parsed_at":"2022-09-11T06:50:08.405Z","dependency_job_id":null,"html_url":"https://github.com/Olical/Heir","commit_stats":null,"previous_names":["wolfy87/heir"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2FHeir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2FHeir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2FHeir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Olical%2FHeir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Olical","download_url":"https://codeload.github.com/Olical/Heir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008215,"owners_count":21359949,"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":["classes","inheritance","javascript"],"created_at":"2024-11-09T16:29:49.660Z","updated_at":"2025-12-12T03:58:52.142Z","avatar_url":"https://github.com/Olical.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heir [![npm](https://img.shields.io/npm/v/heir.svg)](https://www.npmjs.com/package/heir)\n\nHelper functions for prototypical inheritance in JavaScript.\n\nUse the source code and JSDoc comments as documentation, here's a quick example to get you started.\n\n```javascript\nconst heir = require('heir')\n\n// Create the base class.\nfunction Base() {}\n\n// Add a method.\nBase.prototype.foo = function () {\n  return 'Base#foo'\n}\n\n// Create a sub class which inherits from base.\nfunction Sub() {}\nheir.inherit(Sub, Base)\n\n// Mix in some functionality enhancing objects.\nheir.mixin(Sub, events)\nheir.mixin(Sub, pooling)\n\n// Change the original method.\nSub.prototype.foo = function () {\n  return [\n    'Sub#foo',\n    Sub._super.foo.call(this)\n  ].join(', ')\n}\n\n// Create an instance of Sub and call it's method.\nconst s = new Sub()\ns.foo() // Returns \"Sub#foo, Base#foo\"\n```\n\n## Unlicense\n\nThis project is given to you under the [unlicense][], as documented in the `UNLICENSE` file in this directory. Enjoy.\n\n[unlicense]: http://unlicense.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folical%2Fheir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folical%2Fheir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folical%2Fheir/lists"}