UNPKG

react-bootstrap

Version:

Bootstrap 3 components build with React

48 lines (38 loc) 1.36 kB
/** * Copyright 2014, Facebook, Inc. * All rights reserved. * * This file contains an unmodified version of: * https://github.com/facebook/react/blob/v0.12.0/src/vendor/stubs/Object.assign.js * * This source code is licensed under the BSD-style license found here: * https://github.com/facebook/react/blob/v0.12.0/LICENSE * An additional grant of patent rights can be found here: * https://github.com/facebook/react/blob/v0.12.0/PATENTS */ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign function assign(target, sources) { if (target == null) { throw new TypeError('Object.assign target cannot be null or undefined'); } let to = Object(target); let hasOwnProperty = Object.prototype.hasOwnProperty; for (let nextIndex = 1; nextIndex < arguments.length; nextIndex++) { let nextSource = arguments[nextIndex]; if (nextSource == null) { continue; } let from = Object(nextSource); // We don't currently support accessors nor proxies. Therefore this // copy cannot throw. If we ever supported this then we must handle // exceptions and side-effects. We don't support symbols so they won't // be transferred. for (let key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } } return to; } export default assign;