Have ideas to improve npm?Join in the discussion! »

    mixup

    0.1.2 • Public • Published

    mixup Build Status

    Mixins for CoffeeScript

    Fast, simple mixin library for CoffeeScript. Supports instance and class variables. Does not to do any fancy linearization or anything like that. Each class in a mixup clobbers previously defined methods. If you want something closer to Python's multiple inheritance, checkout heterarchy.

    Installation

    $ npm install mixup

    Usage

    mixup = require 'mixup'
     
    class A
      method: -> 'A'
     
    class B extends A
      method: -> "B > #{super}"
     
    class C extends A
      @classmethod: -> "C"
      method: -> "C > #{super}"
     
    class D extends mixup BC
      method: -> "D > #{super}"
     
    = new D
    console.log d.method()
    console.log D.classmethod()

    Would output:

    D > C > A
    C
    

    Install

    npm i mixup

    DownloadsWeekly Downloads

    2

    Version

    0.1.2

    License

    none

    Last publish

    Collaborators

    • avatar