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

object-oriented-extension

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-oriented-extension

Provides support for "protected" fields/methods without conventions.

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

object-oriented-extension

Provides support for "protected" fields and methods without conventions. Also provides inherit functionality.

Usage

if (global.objectOrientedExtension) {
    require("object-oriented-extension/ObjectOriented/JsExtension");
    // or simply: 'global.include("ObjectOriented/JsExtension");', when using include-js package
}
var SomeClass = function (protectedData/*, some other arguments for constructor) {
    protectedData.protectedField = 'some value';
    protectedData.protectedMethod = function () {};
    // Realization
};
SomeClass = SomeClass.injectProtected(); // <- that's it
var SomeChildClass = function (protectedData/*, ... */) {
    SomeClass.call(this, someArgument); // <- Call parent constructor
    // Realization
    this.someMethod = function (someArg) {
        SomeClass.someMethod.call(this, someArg); // <- Call parent method
    };
};
SomeChildClass = SomeChildClass.extend(SomeClass); // <- simply like this (call of "injectProtected" is fully optional in that case)

Almost useless bonus:

// In definition of some class...
this.someMethod = Function.abstractMethod();
this.someAnotherMethod = (function () {}).makeAbstract();

Keywords

OOP

FAQs

Package last updated on 02 Jul 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