Skip to content

THIS PACKAGE HAS BEEN DEPRECATED — A library, that implement mixins in TypeScript or JavaScript classes

License

Notifications You must be signed in to change notification settings

shvabuk/mixiner

Repository files navigation

Mixiner is fast and small javascript library, that implement mixins in TypeScript or JavaScript classes.

Join the chat at https://gitter.im/soft-support/mixiner npm version codecov Build Status

Deprecated

This package has been deprecated.

Basic TypeScript usage

// create mixin
class SpeackableMixin {
    protected phrase: string;
    public speak(): string {
        return this.phrase;
    }
}
// implement SpeackableMixin
@mixiner(SpeackableMixin)
class Duck {
    protected phrase = 'quack';
    public speak: () => string;
}
// create instance
const donald = new Duck();
// test instance
donald.speak(); // 'quack'

Basic JS usage

// create mixin
class SpeackableMixin {
    speak() {
        return this.phrase;
    }
}
// implement SpeackableMixin
const Duck = mixiner(SpeackableMixin)(class Duck {
    constructor() {
        super();
        this.phrase = 'quack';
    }
});

// create instance
const donald = new Duck();
// test instance
donald.speak(); // 'quack'

Download

Installation

Using npm:

$ npm install --save mixiner

TypeScript:

import mixiner from 'mixiner';

Node.js / CommonJS:

const mixiner = require('mixiner');

Support

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE 9-11

Tested in:

  • Node.js 8

License

Mixiner is released under the MIT license

About

THIS PACKAGE HAS BEEN DEPRECATED — A library, that implement mixins in TypeScript or JavaScript classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published