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

copy-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-utils

Utility functions for copying properties from one JavaScript object to another

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
119
increased by221.62%
Maintainers
1
Weekly downloads
 
Created
Source

copy-utils

Utility functions for copying properties from one JavaScript object to another

Install

$ npm install copy-utils

Usage

var utils = require('copy-utils')

API

For all methods below, the first param is the source object from which to copy

copy(src, dest) -> dest

Copies all properties from source to destination. Returns the destination object.

If no dest is specified, it will be asigned an empty object.

utils.copy(src, dest)
var person = { name: 'john', age: 5}
var clone = {age: 1}
utils.copy(person, clone) // -> clone.age == 5, clone.name = 'john'

copyIf(src, dest) -> dest

Copies all properties from source to destination, if the property does not exist into the destination (that is, if the destination has an undefined value in the corresponding key)

Keywords

FAQs

Package last updated on 22 Sep 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