mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
committed by
Paul O’Shannessy
parent
f0eae5086b
commit
6cbeee1e59
@@ -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(): ' +
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user