mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-05 20:44:43 +01:00
incorperate review comments
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Converts an argument into an array
|
||||
* @param arg a argument value. Can be undefined, en entry or an array
|
||||
*/
|
||||
export function asArray<T>(arg: T | T[] | undefined): T[] {
|
||||
if (arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return arg;
|
||||
}
|
||||
return [arg];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether an argument is present.
|
||||
*/
|
||||
export function hasArgs<T>(arg: T | T[] | undefined): boolean {
|
||||
if (arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return !!arg.length;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user