New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

double-latte

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

double-latte

Multiple inheritance for CoffeeScript

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Double Latte

Python-like MRO based multiple inheritance for CoffeeScript.

Works with all javascript engines supported by CoffeeScript.

Example


{multiple, isinstance, issubclass} = require "double-latte"


class A
    constructor: ->
        console.log "A"


class B extends A
    constructor: ->
        console.log "B"
        super


class C extends A
    constructor: ->
        console.log "C"
        super


class D extends multiple B, C
    constructor: ->
        console.log "D"
        super


d = new D  # will print D; B; C; A;
isinstance d, B  # true

Install

npm install double-latte

FAQ

Q: Can I use this with <insert favorite compile-to-javascript language here> *

A: Probably not. This relies on the cls.__super__ property that CoffeeScript uses to figure out what parent to call. If your compiler does that, then maybe.

Q: How fast is this?

A: Fast enough ( Guido for president! ). If you're that worried about performance then you should probably code in javascript directly.

Q: What's the deal with isinstance?

A: For technical reasons, the instanceof operator doesn't work with classes that have multiple parents. The isinstance and issubclass are provided to work around this fact.

FAQs

Package last updated on 16 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts