style: align multiline ternary operators

This commit is contained in:
2026-09-28 16:37:01 +03:00
committed by ksv741
parent b78c215ff1
commit 183b7f1efd
54 changed files with 986 additions and 982 deletions
@@ -23,8 +23,8 @@ export class GetStockCompanyUseCase {
observe,
);
return {
data: result.values.instrument ?
{
data: result.values.instrument
? {
description: result.values.description ?? null,
metrics: metrics(
result.values.fundamentals ?? null,
@@ -32,8 +32,8 @@ export class GetStockCompanyUseCase {
),
unavailable: result.unavailable,
observedAt: result.observedAt,
} :
null,
}
: null,
meta: result.meta,
};
}
@@ -51,22 +51,22 @@ export function metrics(
][] = [
['marketCapitalization', 'money', null],
['peRatioTtm', 'ratio', 'TTM'],
...(bank ?
([
...(bank
? ([
['priceToBookTtm', 'ratio', 'TTM'],
['roe', 'percent', null],
] as typeof selection) :
([
] as typeof selection)
: ([
['revenueTtm', 'money', 'TTM'],
['ebitdaTtm', 'money', 'TTM'],
] as typeof selection)),
['netIncomeTtm', 'money', 'TTM'],
...(!bank ?
([
...(!bank
? ([
['totalDebtMrq', 'money', 'MRQ'],
['netDebtToEbitda', 'ratio', null],
] as typeof selection) :
[]),
] as typeof selection)
: []),
];
return selection.flatMap(([key, unit, period]) => {
// eslint-disable-next-line security/detect-object-injection -- Keys come from the fixed metric selection declared above.
@@ -74,8 +74,8 @@ export function metrics(
const currency = values.currency?.toUpperCase() || null;
return typeof value === 'number' &&
Number.isFinite(value) &&
(unit !== 'money' || currency) ?
[
(unit !== 'money' || currency)
? [
{
key,
value,
@@ -83,7 +83,7 @@ export function metrics(
period,
currency: unit === 'money' ? currency : null,
},
] :
[];
]
: [];
});
}