{"id":21186598,"url":"https://github.com/fetchte/defclass","last_synced_at":"2025-03-14T20:18:14.069Z","repository":{"id":89445585,"uuid":"47094601","full_name":"fetchTe/defclass","owner":"fetchTe","description":"Simple Classical Inheritance","archived":false,"fork":false,"pushed_at":"2017-01-16T05:00:53.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T04:11:37.606Z","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/fetchTe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-30T04:07:05.000Z","updated_at":"2016-11-15T20:48:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"73a65df0-c020-41e5-8e06-f4765fbb790f","html_url":"https://github.com/fetchTe/defclass","commit_stats":null,"previous_names":["fetchte/defclass","artisin/defclass"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchTe%2Fdefclass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchTe%2Fdefclass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchTe%2Fdefclass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetchTe%2Fdefclass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fetchTe","download_url":"https://codeload.github.com/fetchTe/defclass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639555,"owners_count":20323511,"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-20T18:24:36.951Z","updated_at":"2025-03-14T20:18:14.027Z","avatar_url":"https://github.com/fetchTe.png","language":"JavaScript","readme":"# defclass\nSimple classical inheritance that is a whopping ten lines. Its [Augment](http://github.com/javascript/augment) without the augment.\n\nIn the words of Aadit Shah\n\u003e No premature optimization. No need to read the documentation of libraries like ClassManager. I can directly focus on the task at hand and optimize those things that really need optimization.\n\n\n## Usage\n```js\nconst defclass = require('defclass');\n\nconst Beer = defclass({\n  constructor: function (type) {\n    this.type = type;\n    this.count = 100;\n    this.temp = 'cold';\n  },\n  getADrink: function () {\n    --this.count;\n    console.log(`Here's a ${this.temp} ${this.type}!`);\n  }\n});\n\nconst favBeer = new Beer('Spotted Cow');\nfavBeer.getADrink(); // Here's a cold Spotted Cow!\n```\n\nIf you need to inherit from another class use `extend`.\n```js\nconst GrabAnother = defclass.extend(Beer, {\n  sing: function () {\n    console.log(`${this.count} bottles of ${this.temp} ${this.type}'s on the wall.`);\n  }\n});\n\nconst makeMeDance = new GrabAnother(`John's White Ale`);\nmakeMeDance.getADrink(); // Here's a John's White Ale!\nmakeMeDance.sing(); // 99 bottles of cold John's White Ale's on the wall.\n```\n\n## Credit\n+ [Aadit M Shah](http://aaditmshah.github.io/) \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetchte%2Fdefclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffetchte%2Fdefclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetchte%2Fdefclass/lists"}