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

object-assign

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-assign - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

21

object-assign.js

@@ -21,12 +21,17 @@ /*!

var pendingException;
var from;
var keys;
var to = ToObject(target);
var from = ToObject(source);
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
try {
to[keys[i]] = from[keys[i]];
} catch (err) {
if (pendingException === undefined) {
pendingException = err;
for (var s = 1; s < arguments.length; s++) {
from = ToObject(arguments[s]);
keys = Object.keys(from)
for (var i = 0; i < keys.length; i++) {
try {
to[keys[i]] = from[keys[i]];
} catch (err) {
if (pendingException === undefined) {
pendingException = err;
}
}

@@ -33,0 +38,0 @@ }

{
"name": "object-assign",
"version": "0.2.2",
"version": "0.3.0",
"description": "ES6 Object.assign() ponyfill",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -32,3 +32,3 @@ # object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)

// multiple sources
[{bar: 1}, {baz: 2}].reduce(objectAssign, {foo: 0});
objectAssign({foo: 0}, {bar: 1}, {baz: 3});
//=> {foo: 0, bar: 1, baz: 2}

@@ -40,14 +40,7 @@ ```

### objectAssign(target, source)
### objectAssign(target, source, [source, ...])
Assigns enumerable own properties of the `source` object to the `target` object and returns the `target` object.
Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
## Multiple sources
Unfortunately support for multiple sources aren't defined in the Object.assign spec.
However, you can easily achieve it with `[target, source, source, ...].reduce(objectAssign)`.
## Resources

@@ -54,0 +47,0 @@

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