Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
xtend
Advanced tools
Package description
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.
Readme
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 presedence.
var extend = require("xtend")
var combination = extend({
a: "a"
}, {
b: "b"
})
// { a: "a", b: "b" }
FAQs
extend like a boss
The npm package xtend receives a total of 22,648,065 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.