Skip to content

Commit

Permalink
Delete flattenChildren (#10224)
Browse files Browse the repository at this point in the history
* Delete flattenChildren

* Stop exporting mapIntoWithKeyPrefixInternal

* Remove unescapeInDev()

flattenChildren() was the only traverseAllChildren() caller that relied on it.
  • Loading branch information
gaearon authored Jul 20, 2017
1 parent 7b9f643 commit 9cf888f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 119 deletions.
1 change: 0 additions & 1 deletion src/isomorphic/children/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function toArray(children) {
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray,
};
Expand Down
92 changes: 0 additions & 92 deletions src/isomorphic/children/flattenChildren.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/isomorphic/children/traverseAllChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';

var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');

var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Expand Down Expand Up @@ -49,30 +48,6 @@ function escape(key: string): string {
return '$' + escapedString;
}

var unescapeInDev = emptyFunction;
if (__DEV__) {
/**
* Unescape and unwrap key for human-readable display
*
* @param {string} key to unescape.
* @return {string} the unescaped key.
*/
unescapeInDev = function(key: string): string {
var unescapeRegex = /(=0|=2)/g;
var unescaperLookup = {
'=0': '=',
'=2': ':',
};
var keySubstring = key[0] === '.' && key[1] === '$'
? key.substring(2)
: key.substring(1);

return ('' + keySubstring).replace(unescapeRegex, function(match) {
return unescaperLookup[match];
});
};
}

/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
Expand Down Expand Up @@ -137,7 +112,6 @@ function traverseAllChildrenImpl(
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
unescapeInDev,
);
return 1;
}
Expand Down

0 comments on commit 9cf888f

Please sign in to comment.