{"name":"class-extend","version":"1.0.0","description":"Backbone like Class.extend utility for Node","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/SBoudrias/class-extend.git"},"keywords":["inheritance","oop","class","extend"],"author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"license":"MIT","devDependencies":{"mocha":"^11.0.1","sinon":"^19.0.2"},"gitHead":"c1a25c9f30cf7a22e59d8bfbca2bea40591b0860","bugs":{"url":"https://github.com/SBoudrias/class-extend/issues"},"homepage":"https://github.com/SBoudrias/class-extend#readme","_id":"class-extend@1.0.0","_nodeVersion":"22.9.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-ZzPbGCuwQyOSj2XSU7toYyzVIhujeV9lHDDFXtWkZ09DwSz4Ot5egsIe7EHjp7gLsO9fOaCzNMFFsqxGt7518w==","shasum":"8cc6c7697ec924f8ee41cf3c1a7beb01fd6bc0bf","tarball":"http://registry-npm.ywwl.com/class-extend/download/class-extend-1.0.0.tgz","fileCount":3,"unpackedSize":3201,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHcPx7iI2NBDQ7ERpqu1km6fTHdL3b+TjxfjPhoqsGVxAiBYbFUS62abVCbi+TuPF4e6aCttScZ++t96CrmJMUMdLA=="}],"size":1492,"noattachment":false,"key":"/class-extend/-/class-extend-1.0.0.tgz"},"_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"directories":{},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/class-extend_1.0.0_1736547442937_0.9125120841915513"},"_hasShrinkwrap":false,"readme":"Class.extend\n============\n\nBackbone like `.extend` inheritance helper for Node.js\n\nUsage\n------------\n\nYou basically got two options:\n\n``` javascript\n// 1. Extend from the blank class\nconst Base = require('class-extend');\nconst Sub = Base.extend();\n\n// 2. Add the .extend helper to a class\nMyClass.extend = require('class-extend').extend;\n```\n\n#### `.extend()`\n\n`.extend` allow you to assign prototype and static methods.\n\nIf no `constructor` method is assigned, the parent constructor method will be called by default.\n\n``` javascript\n// Extend a class\nconst Sub = Parent.extend({\n  // Overwrite the default constructor\n  constructor() {},\n\n  // Sub class prototypes methods\n  hello() { console.log('hello'); }\n}, {\n  // Constructor static methods\n  hey() { console.log('hey'); }\n});\n\nSub.hey();\n// LOG: hey\n\nconst instance = new Sub();\ninstance.hello();\n// LOG: hello\n```\n\n#### `.__super__`\n\nSub classes are assigned a `__super__` static property pointing to their parent prototype.\n\n``` javascript\nconst Sub = Parent.extend();\nassert(Sub.__super__ === Parent.prototype);\n```\n\nLicense\n---------------\n\nCopyright (c) 2025 Simon Boudrias  \nLicensed under the MIT license.\n","publish_time":1736547443094,"_cnpm_publish_time":1736547443094,"dist-tags":{"latest":"1.0.0"}}