Skip to content

Commit

Permalink
Rename from iterator to iterable
Browse files Browse the repository at this point in the history
and split the functionality facebook#19831
  • Loading branch information
engprodigy committed Sep 18, 2020
1 parent 26857ec commit 4ae9339
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/react-devtools-shared/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ export type DataType =
| 'html_all_collection'
| 'html_element'
| 'infinity'
| 'iterator'
| 'iterable'
| 'opaque_iterable'
| 'nan'
| 'null'
| 'number'
Expand Down Expand Up @@ -460,8 +461,11 @@ export function getDataType(data: Object): DataType {
// If it doesn't error, we know it's an ArrayBuffer,
// but this seems kind of awkward and expensive.
return 'array_buffer';
} else if (typeof data[Symbol.iterator] === 'function') {
return 'iterator';
}else if (data()[Symbol.iterator]() === 'data') {
return 'opaque_iterable';
}
else if (typeof data[Symbol.iterator] === 'function') {
return 'iterable';
} else if (data.constructor && data.constructor.name === 'RegExp') {
return 'regexp';
} else {
Expand Down Expand Up @@ -638,7 +642,7 @@ export function formatDataForPreview(
} else {
return shortName;
}
case 'iterator':
case 'iterable':
const name = data.constructor.name;
if (showFormattedValue) {
// TRICKY
Expand Down

0 comments on commit 4ae9339

Please sign in to comment.