Use Array.from's map directly instead of a second call to map

This commit is contained in:
Matt Bierner
2021-04-12 14:42:39 -07:00
parent 32a7858a63
commit d5f4e119e0
3 changed files with 3 additions and 3 deletions

View File

@@ -41,7 +41,7 @@ window.onload = () => {
function doAfterImagesLoaded(cb: () => void) {
const imgElements = document.getElementsByTagName('img');
if (imgElements.length > 0) {
const ps = Array.from(imgElements).map(e => {
const ps = Array.from(imgElements, e => {
if (e.complete) {
return Promise.resolve();
} else {

View File

@@ -134,7 +134,7 @@ export default class MarkdownWorkspaceSymbolProvider extends Disposable implemen
this._workspaceMarkdownDocumentProvider.onDidDeleteMarkdownDocument(this.onDidDeleteDocument, this, this._disposables);
}
const allSymbolsSets = await Promise.all(Array.from(this._symbolCache.values()).map(x => x.value));
const allSymbolsSets = await Promise.all(Array.from(this._symbolCache.values(), x => x.value));
const allSymbols = allSymbolsSets.flat();
return allSymbols.filter(symbolInformation => symbolInformation.name.toLowerCase().indexOf(query.toLowerCase()) !== -1);
}