https://github.com/digitaledgeit/js-extend-class
Classical object inheritance.
https://github.com/digitaledgeit/js-extend-class
Last synced: 10 months ago
JSON representation
Classical object inheritance.
- Host: GitHub
- URL: https://github.com/digitaledgeit/js-extend-class
- Owner: digitaledgeit
- Created: 2014-06-13T05:14:05.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-09T01:33:15.000Z (about 11 years ago)
- Last Synced: 2025-02-25T12:03:21.727Z (over 1 year ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# extend-class
Creates a new class inheriting the methods and properties of a parent class, and copies a new set of methods and properties to the child class.
- Uses [prototypal inheritance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain)
- The `instanceof` operator works
- If present, a constructor named `construct` is called
**Note:** Large prototype chains can impact performance. Use sparingly.
## Install
With npm:
npm install --save extend-class
With componentjs:
component install --save extend-class
## Example
var extend = require('extend-class');
...
var Cat = extend(Animal, {
construct: function() {
Animal.call(this);
},
noise: function() {
return 'Meeow!'
}
});