-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename from iterator to iterable and split the functionality #19831
Changes from 8 commits
ca2d02d
60b8bb5
2cf0346
ce81af1
2558946
c629822
cf19623
f7052e8
28bb959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,6 +376,7 @@ export type DataType = | |
| 'html_element' | ||
| 'infinity' | ||
| 'iterator' | ||
| 'opaque_iterator' | ||
| 'nan' | ||
| 'null' | ||
| 'number' | ||
|
@@ -437,6 +438,8 @@ export function getDataType(data: Object): DataType { | |
return 'array_buffer'; | ||
} else if (typeof data[Symbol.iterator] === 'function') { | ||
return 'iterator'; | ||
} else if (data[Symbol.iterator] === 'data') { | ||
return 'opaque_iterator'; | ||
} else if (data.constructor && data.constructor.name === 'RegExp') { | ||
return 'regexp'; | ||
} else { | ||
|
@@ -615,6 +618,7 @@ export function formatDataForPreview( | |
} | ||
case 'iterator': | ||
const name = data.constructor.name; | ||
|
||
if (showFormattedValue) { | ||
// TRICKY | ||
// Don't use [...spread] syntax for this purpose. | ||
|
@@ -653,6 +657,9 @@ export function formatDataForPreview( | |
} else { | ||
return `${name}(${data.size})`; | ||
} | ||
case 'opaque_iterator': { | ||
return `${data.constructor.name}(${data.size})`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will result in the string
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would result in a different format than we're looking for here ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I know. That's what I commented above :) |
||
} | ||
case 'date': | ||
return data.toString(); | ||
case 'object': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. Why would
data[Symbol.iterator]
return the string "data"?