Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove comments for types
  • Loading branch information
koba04 committed Jun 29, 2017
commit 8a306690ca94a155a18237e928b45fd1775e4414
16 changes: 0 additions & 16 deletions src/isomorphic/children/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ var didWarnAboutMaps = false;

/**
* Generate a key string that identifies a ReactElement within a set.
*
* @param {*} element A ReactElement that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getReactElementKey(element, index) {
// Do some typechecking here since we call this blindly. We want to ensure
Expand Down Expand Up @@ -205,11 +201,6 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children: mixed, func: () => mixed, context?: Object): ?mixed[] {
if (children == null) {
Expand All @@ -234,10 +225,6 @@ function mapChildren(children: mixed, func: () => mixed, context?: Object): ?mix
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children: mixed, forEachFunc: () => mixed, forEachContext?: Object): void {
mapChildren(children, forEachFunc, forEachContext);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to implement forEach in terms of map because we don't want to allocate the result just to ignore it. It's fine to duplicate the code in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've fixed it!

Expand All @@ -261,9 +248,6 @@ function toArray(children: mixed): ?mixed[] {
* `props.children`.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children: mixed): number {
if (children == null) {
Expand Down