Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copy-to

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-to

copy an object's properties to another object

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
467K
decreased by-34.36%
Maintainers
1
Weekly downloads
 
Created

What is copy-to?

The 'copy-to' npm package is a utility for copying properties from one object to another. It is useful for shallow copying and merging objects, which can be particularly handy in various scenarios such as data manipulation, configuration management, and more.

What are copy-to's main functionalities?

Copy properties from one object to another

This feature allows you to copy all properties from a source object to a target object. It is useful for creating a new object with the same properties as an existing one.

const copy = require('copy-to');
const target = {};
const source = { a: 1, b: 2 };
copy(source).to(target);
console.log(target); // { a: 1, b: 2 }

Copy selected properties

This feature allows you to copy only selected properties from the source object to the target object. It is useful when you only need specific properties from an object.

const copy = require('copy-to');
const target = {};
const source = { a: 1, b: 2, c: 3 };
copy(source).pick('a', 'c').to(target);
console.log(target); // { a: 1, c: 3 }

Copy properties except some

This feature allows you to copy all properties except the specified ones from the source object to the target object. It is useful when you want to exclude certain properties.

const copy = require('copy-to');
const target = {};
const source = { a: 1, b: 2, c: 3 };
copy(source).except('b').to(target);
console.log(target); // { a: 1, c: 3 }

Other packages similar to copy-to

Keywords

FAQs

Package last updated on 26 Oct 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc