2.0.0 • Published 6 years ago

mixiner v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

MIXINER

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

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

2.0.0

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago