Replace !isFalsyOrEmpty with isNonEmptyArray

This new call works as a type guard and can help avoid writing double negations

Avoid either call in cases where we were iterating over the possibly undefined value. Use `|| []` for these
This commit is contained in:
Matt Bierner
2018-11-14 16:06:13 -08:00
parent 8392c36a49
commit 30b2a5fd94
16 changed files with 41 additions and 51 deletions

View File

@@ -10,7 +10,7 @@ import * as extHostTypeConverter from 'vs/workbench/api/node/extHostTypeConverte
import { cloneAndChange } from 'vs/base/common/objects';
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ObjectIdentifier, IMainContext } from './extHost.protocol';
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
import { isNonEmptyArray } from 'vs/base/common/arrays';
import * as modes from 'vs/editor/common/modes';
import * as vscode from 'vscode';
import { ILogService } from 'vs/platform/log/common/log';
@@ -189,7 +189,7 @@ export class CommandsConverter {
title: command.title
};
if (command.command && !isFalsyOrEmpty(command.arguments)) {
if (command.command && isNonEmptyArray(command.arguments)) {
// we have a contributed command with arguments. that
// means we don't want to send the arguments around