Socket
Socket
Sign inDemoInstall

copy-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    copy-utils

Utility functions for copying properties from one JavaScript object to another


Version published
Weekly downloads
88
increased by51.72%
Maintainers
1
Install size
39.8 kB
Created
Weekly downloads
 

Readme

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

Last updated on 22 Sep 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc