perks/codegen-csharp/ternery.ts

10 строки
666 B
TypeScript
Исходник Обычный вид История

2018-11-06 22:03:52 +03:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExpressionOrLiteral, LiteralExpression, valueOf } from './expression';
export function Ternery(booleanExpression: ExpressionOrLiteral, trueResult: ExpressionOrLiteral, falseResult: ExpressionOrLiteral) {
return new LiteralExpression(`${valueOf(booleanExpression)} ? ${trueResult} : ${falseResult}`);
}