-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Minor cleanup to symbolWalker #18549
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
Changes from all commits
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 |
---|---|---|
|
@@ -994,11 +994,6 @@ namespace ts { | |
|
||
/** | ||
* Gets the owned, enumerable property keys of a map-like. | ||
* | ||
* NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use | ||
* Object.keys instead as it offers better performance. | ||
* | ||
* @param map A map-like. | ||
*/ | ||
export function getOwnKeys<T>(map: MapLike<T>): string[] { | ||
const keys: string[] = []; | ||
|
@@ -1011,6 +1006,17 @@ namespace ts { | |
return keys; | ||
} | ||
|
||
export function getOwnValues<T>(sparseArray: T[]): T[] { | ||
const values: T[] = []; | ||
for (const key in sparseArray) { | ||
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'm sure I'm missing something, but how is this different from a for-of loop? 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. A 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. It's also supposedly identical to |
||
if (hasOwnProperty.call(sparseArray, key)) { | ||
values.push(sparseArray[key]); | ||
} | ||
} | ||
|
||
return values; | ||
} | ||
|
||
/** Shims `Array.from`. */ | ||
export function arrayFrom<T, U>(iterator: Iterator<T>, map: (t: T) => U): U[]; | ||
export function arrayFrom<T>(iterator: Iterator<T>): T[]; | ||
|
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.
Comment outdated;
Map<T>
is now a real ES6 map, so we would use the.keys()
method.