
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
static-extend
Advanced tools
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.
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.
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'
Similar to static-extend, extend-shallow allows for the extension of properties from one object to another. However, it focuses on shallow copying of properties and does not specifically target static properties of classes, making it less specialized for class-based inheritance.
node.extend is another package that provides functionality to extend objects. It supports deep copying, which can be toggled via an option. Unlike static-extend, which is tailored for static properties in classes, node.extend is more general-purpose and can be used for a broader range of object extension tasks.
FAQs
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.
The npm package static-extend receives a total of 13,651,093 weekly downloads. As such, static-extend popularity was classified as popular.
We found that static-extend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.