diff --git a/src/browser/ReactDOM.js b/src/browser/ReactDOM.js index 8439a24b4b..79947d2975 100644 --- a/src/browser/ReactDOM.js +++ b/src/browser/ReactDOM.js @@ -22,7 +22,7 @@ var ReactDOMComponent = require('ReactDOMComponent'); var mergeInto = require('mergeInto'); -var objMapKeyVal = require('objMapKeyVal'); +var mapObject = require('mapObject'); /** * Creates a new React class that is idempotent and capable of containing other @@ -39,7 +39,7 @@ var objMapKeyVal = require('objMapKeyVal'); * @param {boolean} omitClose True if the close tag should be omitted. * @private */ -function createDOMComponentClass(tag, omitClose) { +function createDOMComponentClass(omitClose, tag) { var Constructor = function() {}; Constructor.prototype = new ReactDOMComponent(tag, omitClose); Constructor.prototype.constructor = Constructor; @@ -68,7 +68,7 @@ function createDOMComponentClass(tag, omitClose) { * * @public */ -var ReactDOM = objMapKeyVal({ +var ReactDOM = mapObject({ a: false, abbr: false, address: false, diff --git a/src/core/__tests__/ReactMultiChildReconcile-test.js b/src/core/__tests__/ReactMultiChildReconcile-test.js index 3ff91ecbc2..a560ac13d2 100644 --- a/src/core/__tests__/ReactMultiChildReconcile-test.js +++ b/src/core/__tests__/ReactMultiChildReconcile-test.js @@ -25,7 +25,7 @@ var React = require('React'); var ReactTestUtils = require('ReactTestUtils'); var ReactMount = require('ReactMount'); -var objMapKeyVal = require('objMapKeyVal'); +var mapObject = require('mapObject'); var stripEmptyValues = function(obj) { var ret = {}; @@ -126,7 +126,7 @@ var FriendsStatusDisplay = React.createClass({ function getInteralStateByUserName(statusDisplays) { - return objMapKeyVal(statusDisplays, function(key, statusDisplay) { + return mapObject(statusDisplays, function(statusDisplay, key) { return statusDisplay.getInternalState(); }); } diff --git a/src/utils/objMapKeyVal.js b/src/utils/objMapKeyVal.js deleted file mode 100644 index e2f93ebb8c..0000000000 --- a/src/utils/objMapKeyVal.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule objMapKeyVal - */ - -"use strict"; - -/** - * Behaves the same as `objMap` but invokes func with the key first, and value - * second. Use `objMap` unless you need this special case. - * Invokes func as: - * - * func(key, value, iteration) - * - * @param {?object} obj Object to map keys over - * @param {!function} func Invoked for each key/val pair. - * @param {?*} context - * @return {?object} Result of mapping or null if obj is falsey - */ -function objMapKeyVal(obj, func, context) { - if (!obj) { - return null; - } - var i = 0; - var ret = {}; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - ret[key] = func.call(context, key, obj[key], i++); - } - } - return ret; -} - -module.exports = objMapKeyVal;