Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@preterer/mixin

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

@preterer/mixin

Typescript extendable mixin approach

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

mixin

Extendable typescript mixin approach. Currently supports up to 6 mixed classes.

Usage

class A {
    public a: string = "a";

    public getA(): string {
        return this.a;
    }

    public overwritten(): string {
        return "a";
    }
}

class B {
    public b: string = "b";

    public getB(): string {
        return this.b;
    }

    public overwritten(): string {
        return "b":
    }
}

class C extends mixin(A, B) {
    public c: string = "c";

    public getC(): string {
        return this.c;
    }

    public overwritten(): string {
        return "c";
    }
}

const c = new C();

c.a; // "a"
c.b; // "b"
c.c; // "c"
c.getA(); // "a"
c.getB(); // "b"
c.getC(); // "c"
c.overwritten(); // "c"

const MixedClass = mixin(A, B);
const mixed = new MixedClass();

mixed.a; // "a"
mixed.b; // "b"
mixed.getA(); // "a"
mixed.getB(); // "b"
mixed.overwritten(); // "b"

Project setup

npm install

Tests

npm run test

Build

npm run build

Keywords

FAQs

Package last updated on 11 Feb 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc