Remove objMapKeyVal

This commit is contained in:
Christoph Pojer
2014-03-25 13:05:44 -07:00
committed by Paul O’Shannessy
parent 6cbeee1e59
commit f10f32aaaf
3 changed files with 5 additions and 52 deletions
+3 -3
View File
@@ -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,
@@ -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();
});
}
-47
View File
@@ -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;