
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
A simple function to merge methods and property getters/setters into prototypes.
objMix is a simple utility that lets you merge methods, simple properties, and property descriptors into an object.
I've embraced JavaScript's prototypal nature and hate high-level class systems that try to turn JavaScript into something it is not. However I do like to simplify setting methods and properties onto a prototype. Up to now I've simply been using lodash's _.merge to do this. However I've recently been using getters in some node based projects. And while I can define these with Object.defineProperties it separates the definition of related properties and methods from each other.
objMix is a solution to that problem, call it with a base object such as a prototype and another object. objMix will merge functions and simple properties from the other object into that base object and use Object.defineProperty for anything that looks like a property descriptor.
var objMix = require('obj-mix');
function Foo() {
// This is Foo
}
objMix(Foo.prototype, {
bar: function() {
return "This is a method.";
},
baz: "This is a property.",
qux: {
get: function() {
return "This is a property with a getter.";
}
}
});
var foo = new Foo();
console.log(foo.bar()); // "This is a method.";
console.log(foo.baz); // "This is a property.";
console.log(foo.qux); // "This is a property with a getter.";
FAQs
A simple function to merge methods and property getters/setters into prototypes.
We found that obj-mix 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.