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

extend-interface

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extend-interface

extend-interface ================

  • 0.0.3
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by28.57%
Maintainers
1
Weekly downloads
 
Created
Source

extend-interface

An ultra-lightweight prototypal inheritance mechanism built into the class definition itself.

Usage

    const extendClass = require('extend-interface');

    let MyClass = function(){ }

    MyClass.prototype.output = function(){
        console.log(this.value())
    };
    MyClass.prototype.value = function(){
        throw new Error('No value() implementation')
    };
    MyClass.extend = function(cls, cns){
        var cons = cns || function(){
            MyClass.apply(this, arguments);
            return this;
        };
        return extendClass(cls, cons, MyClass);
    };

then, in another class, you can implement:

    const extendClass = require('extend-interface');

    let SubClass = MyClass.extend({
        value : function(){
            return 'awesome';
        }
    })
    let subClassInstance = new SubClass();

FAQs

Package last updated on 15 Oct 2022

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