Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
The xtend npm package is a utility for shallowly copying all properties from one or more source objects to a new object. It is useful for extending objects without modifying the original object, making it ideal for configurations, options, and default settings manipulation.
Extending an object
This feature allows you to combine properties from one or more source objects into a new object. The properties from the source objects are copied into the new object, with later sources' properties overwriting earlier ones.
var extend = require('xtend');
var object = extend({key1: 'value1'}, {key2: 'value2'});
console.log(object);
Similar to xtend, object-assign is used for copying the values of all enumerable own properties from one or more source objects to a target object. It uses Object.assign() method which is built-in in ES6, making it a more modern alternative to xtend.
Lodash's merge function offers deep merging capabilities, in contrast to xtend's shallow copy approach. This makes lodash.merge more suitable for complex object structures where nested properties also need to be merged.
Extend like a boss
xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence.
var extend = require("xtend")
// extend returns a new object. Does not mutate arguments
var combination = extend({
a: "a",
b: "c"
}, {
b: "b"
})
// { a: "a", b: "b" }
FAQs
extend like a boss
The npm package xtend receives a total of 23,977,588 weekly downloads. As such, xtend popularity was classified as popular.
We found that xtend 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.