From 73c5ec9f169e16c86b8807fff349d0887c25c91c Mon Sep 17 00:00:00 2001 From: AlexKVal Date: Thu, 28 May 2015 21:16:36 +0300 Subject: [PATCH] [changed] Remove extraneous utils/Object.assign.js --- .babelrc | 3 +++ package.json | 1 + src/Interpolate.js | 3 +-- src/OverlayTrigger.js | 3 +-- src/utils/Object.assign.js | 47 -------------------------------------- 5 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 src/utils/Object.assign.js diff --git a/.babelrc b/.babelrc index 8f85e598f6..6439009999 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,8 @@ { "optional": [ "es7.objectRestSpread" + ], + "plugins": [ + "object-assign" ] } diff --git a/package.json b/package.json index f70ab5a1f0..837c72fda9 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "babel-core": "^5.1.10", "babel-eslint": "^3.0.1", "babel-loader": "^5.0.0", + "babel-plugin-object-assign": "^1.1.0", "bootstrap": "^3.3.4", "brfs": "^1.4.0", "chai": "^2.2.0", diff --git a/src/Interpolate.js b/src/Interpolate.js index 181fb1e4cd..46606b682d 100644 --- a/src/Interpolate.js +++ b/src/Interpolate.js @@ -3,7 +3,6 @@ import React from 'react'; import ValidComponentChildren from './utils/ValidComponentChildren'; -import assign from './utils/Object.assign'; const REGEXP = /\%\((.+?)\)s/; @@ -24,7 +23,7 @@ const Interpolate = React.createClass({ this.props.children : this.props.format; let parent = this.props.component; let unsafe = this.props.unsafe === true; - let props = assign({}, this.props); + let props = Object.assign({}, this.props); delete props.children; delete props.format; diff --git a/src/OverlayTrigger.js b/src/OverlayTrigger.js index 22a7f3d432..d630c52842 100644 --- a/src/OverlayTrigger.js +++ b/src/OverlayTrigger.js @@ -6,7 +6,6 @@ import RootCloseWrapper from './RootCloseWrapper'; import createChainedFunction from './utils/createChainedFunction'; import createContextWrapper from './utils/createContextWrapper'; import domUtils from './utils/domUtils'; -import assign from './utils/Object.assign'; /** * Check if value one is inside or equal to the of value @@ -305,7 +304,7 @@ const OverlayTrigger = React.createClass({ const offset = container.tagName === 'BODY' ? domUtils.getOffset(node) : domUtils.getPosition(node, container); - return assign({}, offset, { + return Object.assign({}, offset, { height: node.offsetHeight, width: node.offsetWidth }); diff --git a/src/utils/Object.assign.js b/src/utils/Object.assign.js deleted file mode 100644 index 820b4d3d6f..0000000000 --- a/src/utils/Object.assign.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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;