/**1* Copyright 2014-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule Object.assign9*/1011// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign1213'use strict';1415function assign(target, sources) {16if (target == null) {17throw new TypeError('Object.assign target cannot be null or undefined');18}1920var to = Object(target);21var hasOwnProperty = Object.prototype.hasOwnProperty;2223for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {24var nextSource = arguments[nextIndex];25if (nextSource == null) {26continue;27}2829var from = Object(nextSource);3031// We don't currently support accessors nor proxies. Therefore this32// copy cannot throw. If we ever supported this then we must handle33// exceptions and side-effects. We don't support symbols so they won't34// be transferred.3536for (var key in from) {37if (hasOwnProperty.call(from, key)) {38to[key] = from[key];39}40}41}4243return to;44}4546module.exports = assign;474849