Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
simple-object-mixin
Advanced tools
Simple mixin is the simplest implementation for a mixin, copying an object's properties onto another
Simple mixin is the simplest implementation for a mixin, copying an object's properties onto another. It has an option for specifying if duplicated properties can be replaced or not in the target object.
Use https://github.com/WebReflection/object-mixin
instead of this module if you can, it's better to use built-in features or their polyfills.
It will not copy the properties from the prototype chain.
npm install simple-object-mixin
Require simple-mixin:
var mixin = require("simple-object-mixin");
Use it with an array:
var objectSource = {
"b": 30,
"c": 40
};
var objectDestination = {
"a": 10,
"b": 20
};
var returnedObject = mixin(objectSource, objectDestination);
returnedObject === objectDestination;
JSON.stringify(objectDestination); //{"a":10,"b":"30", "c":40}
By default, the properties from source are copied onto destination. If there's a duplicated property, it will be replaced. If you don't want the new value to override the existing value, you can use the dontOverride option:
var returnedObject = mixin(objectSource, objectDestination, true /* don't override */);
returnedObject === objectDestination;
JSON.stringify(objectDestination); //{"a":10,"b":"20", "c":40} the value for "b" will be preserved
MIT
FAQs
Simple mixin is the simplest implementation for a mixin, copying an object's properties onto another
We found that simple-object-mixin 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.