@xcore24/mixin
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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')

Package Sidebar

Install

npm i @xcore24/mixin

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

56.6 kB

Total Files

86

Last publish

Collaborators

  • xcore24