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

allot

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allot

Utils for classes

  • 0.1.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Allot

A way of defining interfaces from one JavaScript class to a new class.

The idea is still a little abstract at the moment however its useful for building quick interfaces from one class to another.

Full documentation

Usage

allot.inherits

Classical inheritance to JavaScript, however methods are not copied or referenced they use the proxy methods defined in this module.


function SuperClass() {
};

SuperClass.thing = function () {
  return 'thing';
};

SuperClass.prototype.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.inherits(function () {}, SuperClass);

ChildClass.thing();

var instance = new ChildClass();
instance.doSomething();

allot.factory

Builds a new class based upon SuperClass.

Static methods from instance methods

function SuperClass() {
};

SuperClass.prototype.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.factory(SuperClass, {
  staticProxyPrototypes: ['doSomething']
});

ChildClass.doSomething();

var instance = new ChildClass();

Static methods from static methods

function SuperClass() {
};

SuperClass.doSomething = function () {
  return 'Hello there';
};

var ChildClass = allot.factory(SuperClass, {
  staticProxyMethods: ['doSomething']
});

ChildClass.doSomething();

var instance = new ChildClass();

Status

Build Status Coverage Status Dependency Status devDependency Status

Browser Support

Licence

Copyright (c) 2014 Jonathan Kingston

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.

FAQs

Package last updated on 10 Feb 2014

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