https://github.com/rumkin/protosaurus
Yet another class system for JS based on a ES2015 features
https://github.com/rumkin/protosaurus
Last synced: 9 months ago
JSON representation
Yet another class system for JS based on a ES2015 features
- Host: GitHub
- URL: https://github.com/rumkin/protosaurus
- Owner: rumkin
- Created: 2016-05-24T18:32:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-24T18:34:19.000Z (about 10 years ago)
- Last Synced: 2025-08-13T02:36:08.512Z (10 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Protosaurus
Protosaurus in a basic proto object for custom class system. It's main feature
is support of ES2015 object syntax and customizable inheritance strategies based
on a new features of Symbol properties.
## Install
Install via npm:
```
npm i protosaurus
```
## Example
```javascript
const Protosaurus = require('protosaurus');
const A = Protosaurus.extend({
constructor(name) {
this.name = name;
},
greet() {
return `Hello ${this.name}`;
}
});
const B = A.extend({
greet() {
return `Hi ${this.name}`;
}
});
var a = new A('World');
var b = new B('World');
a.greet(); // => "Hello World"
b.greet(); // => "Hi World"
```