Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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.
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.