@xcore24/mixin
v1.0.0
Published
TypeScript library implementing the Mixin pattern
Downloads
5
Maintainers
Readme
mixin
mixin
is TypeScript library implementing the Mixin pattern.
Installation
To start using mixin install the npm package:
npm install @xcore24/mixin
Basic Usage
import { Mixin } from '@xcore24/mixin'
class Developer {
constructor(public name: string){}
code() {
console.log(`${this.name} is coding..`)
}
}
class FrontendDeveloper extends Developer {
angular() {
console.log(`${this.name} is creating Angular app`)
}
}
class BackendDeveloper extends Developer {
nodejs() {
console.log(`${this.name} is programming on NodeJS`)
}
}
class FullstackDeveloper extends Mixin(FrontendDeveloper, BackendDeveloper) {}
const frontendDeveloper = new FrontendDeveloper('Алексей')
frontendDeveloper.code()
frontendDeveloper.angular()
console.log('\n')
const backendDeveloper = new BackendDeveloper('Степан')
backendDeveloper.code()
backendDeveloper.nodejs()
console.log('\n')
const fullstackDeveloper = new FullstackDeveloper('Сергей')
fullstackDeveloper.code()
fullstackDeveloper.angular()
fullstackDeveloper.nodejs()
console.log('\n')