{"id":22022752,"url":"https://github.com/cj/class.js","last_synced_at":"2026-04-28T21:03:46.527Z","repository":{"id":927905,"uuid":"695840","full_name":"cj/class.js","owner":"cj","description":"High performance class implementation for nodejs","archived":false,"fork":false,"pushed_at":"2010-04-08T22:35:57.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-19T22:38:39.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/cj.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.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":"2010-05-31T18:15:31.000Z","updated_at":"2015-08-12T13:49:01.000Z","dependencies_parsed_at":"2022-08-16T11:30:43.195Z","dependency_job_id":null,"html_url":"https://github.com/cj/class.js","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/cj/class.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fclass.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fclass.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fclass.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fclass.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cj","download_url":"https://codeload.github.com/cj/class.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cj%2Fclass.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32399034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-30T06:22:40.850Z","updated_at":"2026-04-28T21:03:46.494Z","avatar_url":"https://github.com/cj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Class.js\n\n  High performance classical inheritance for **node.js**.\n\n## Installation\n\n  Install the [Kiwi package manager for nodejs](http://github.com/visionmedia/kiwi)\n  and run:\n  \n      $ kiwi -v install class\n\n## About Class.js\n\nWithout wasting performance on cross-browser functionality,\nclass.js is an **extremely light** (_20-ish SLOC_) class implementation.\n\nBy utilizing idiomatic prototypal inheritance techniques this\nimplementation is **very fast**. There are no wrapping or _super_ \nhacks involved.\n\n## Features\n\n  * Fast\n  * Tiny\n  * Mixin support with included() hook\n  * Subclassing support with extended() hook\n\n## Examples\n\n    var Class = require('class').Class\n\n    var User = new Class({\n      extend: {\n        extended: function(subclass){\n          // called when User.extend() is called,\n          // in this case passes Admin\n        }\n      },\n      constructor: function(name){\n        this.name = name\n      },\n      toString: function(){\n        return '[User ' + this.name + ']'\n      }\n    })\n    \n    var Admin = User.extend({\n      constructor: function(name) {\n        User.call(this, name.toUpperCase())\n      }\n    })\n    \n    var SomeMixin = new Class({\n      extend: {\n        included: function(superclass){\n          // called when Admin.include()\n          // is called, in this case Admin\n          // will become the contents of \"superclass\"\n        }\n      },\n      foo: 'bar'\n    })\n    \n    Admin.include(SomeMixin)\n    \n    puts(new Admin('tj'))\n    // =\u003e \"[User TJ]\"\n    \n## Benchmarks\n\nCurrently the benchmarks compare regular **prototypal inheritance**,\nnode's **sys.inherits()**, and **class.js**. Each subclasses _User_\nas _Admin_, and creates an instance **500,000 times**.\n\n    λ  class.js: node benchmark.js\n\n    running 500000 times\n\n    prototype : 68 ms\n    sys.inherits() : 1512 ms\n    class.js : 2510 ms\n\n## Running Tests\n\nSpecs are written using [JSpec](http://jspec.info), however\nno additional installations are required as JSpec is froozen\nto _spec/lib_, just simply run:\n\n    $ make test\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2009 TJ Holowaychuk \u0026lt;tj@vision-media.ca\u0026gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcj%2Fclass.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcj%2Fclass.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcj%2Fclass.js/lists"}