🚀 Socket Launch Week 🚀 Day 4: Introducing Historical Analytics.Learn More
Socket
Sign inDemoInstall
Socket

static-extend

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static-extend

Adds a static `extend` method to a class, to simplify inheritance. Extends the static properties, prototype properties, and descriptors from a `Parent` constructor onto `Child` constructors.

0.1.2
latest
Source
npm
Version published
Weekly downloads
11M
1.31%
Maintainers
1
Weekly downloads
 
Created

What is static-extend?

The static-extend npm package is used to easily extend the static properties and methods of a class. This is particularly useful in object-oriented programming where you might want to inherit or share static properties among multiple classes without affecting their instances directly.

What are static-extend's main functionalities?

Extending static methods and properties

This feature allows you to extend static methods and properties from one constructor function (or class) to another. In the provided code, the Child constructor inherits the static method 'foo' from the Parent constructor.

const staticExtend = require('static-extend');

function Parent() {}
Parent.foo = function() { return 'foo'; };

function Child() {}
staticExtend(Child, Parent);

console.log(Child.foo()); // Outputs: 'foo'

Other packages similar to static-extend

Keywords

class

FAQs

Package last updated on 09 Jun 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