Socket
Book a DemoInstallSign in
Socket

classify128

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classify128

Write JavaScript classes easily

1.2.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Classify

Write JavaScript classes easily

How to use Classify

Use with Node.js / RequireJS

npm i -S classify128
const Classify = require("classify128");

const Logger = Classify({
    prototype: {
        log: function ()
        {
            console.log.apply(console, arguments);
        }
    }
});

const HasName = Classify({
    constructor: function (_super, name)
    {
        _super();
        
        this.name = name;
    },
    
    extends: Logger,
    
    prototype: {
        logName: function ()
        {
            this.log(this.name);
        }
    }
});

const Me = Classify({
    constructor: function (_super)
    {
        _super("Stefan Wimmer");
    },
    
    extends: HasName,
    
    prototype: {
        logTwice: function ()
        {
            this.logName();
            this.logName();
        }
    },
    
    static: {
        instance: function ()
        {
            return new Me();
        }
    }
});

Me.instance().logTwice();

Use in browser

<script src="classify128.js"></script>
var Logger = Classify({
    prototype: {
        log: function ()
        {
            console.log.apply(console, arguments);
        }
    }
});

var HasName = Classify({
    constructor: function (_super, name)
    {
        _super();
        
        this.name = name;
    },
    
    extends: Logger,
    
    prototype: {
        logName: function ()
        {
            this.log(this.name);
        }
    }
});

var Me = Classify({
    constructor: function (_super)
    {
        _super("Stefan Wimmer");
    },
    
    extends: HasName,
    
    prototype: {
        logTwice: function ()
        {
            this.logName();
            this.logName();
        }
    },
    
    static: {
        instance: function ()
        {
            return new Me();
        }
    }
});

Me.instance().logTwice();

Keywords

classify

FAQs

Package last updated on 05 Jul 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.