Rename objMap to mapObject

mapObject fits better with other module names ("flattenChildren", "traverseAllChildren" etc.) and highlights that it only works with objects - which is going to be more important once we'll have an ES6 Map polyfill.
This commit is contained in:
Christoph Pojer
2014-03-25 13:05:43 -07:00
committed by Paul O’Shannessy
parent f0eae5086b
commit 6cbeee1e59
2 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ var keyMirror = require('keyMirror');
var merge = require('merge');
var mixInto = require('mixInto');
var monitorCodeUse = require('monitorCodeUse');
var objMap = require('objMap');
var mapObject = require('mapObject');
var shouldUpdateReactComponent = require('shouldUpdateReactComponent');
var warning = require('warning');
@@ -542,7 +542,7 @@ function mergeObjectsWithNoDuplicateKeys(one, two) {
'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects'
);
objMap(two, function(value, key) {
mapObject(two, function(value, key) {
invariant(
one[key] === undefined,
'mergeObjectsWithNoDuplicateKeys(): ' +
+8 -3
View File
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule objMap
* @providesModule mapObject
*/
"use strict";
@@ -25,12 +25,17 @@
*
* func(value, key, iteration)
*
* Grepable names:
*
* function objectMap()
* function objMap()
*
* @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 objMap(obj, func, context) {
function mapObject(obj, func, context) {
if (!obj) {
return null;
}
@@ -44,4 +49,4 @@ function objMap(obj, func, context) {
return ret;
}
module.exports = objMap;
module.exports = mapObject;