ts-essentials#DeepReadonly TypeScript Examples
The following examples show how to use
ts-essentials#DeepReadonly.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: formatQCMissingData.ts From nextclade with MIT License | 6 votes |
export function formatQCMissingData<TFunction extends TFunctionInterface>(
t: TFunction,
missingData?: DeepReadonly<QcResultMissingData>,
) {
if (!missingData || missingData.status === QcStatus.good) {
return undefined
}
const { score, totalMissing, missingDataThreshold, status } = missingData
let message = t('Missing data found')
if (status === QcStatus.bad) {
message = t('Too much missing data found')
}
return t('{{message}}. Total Ns: {{total}} ({{allowed}} allowed). QC score: {{score}}', {
message,
total: totalMissing,
allowed: missingDataThreshold,
score: round(score),
})
}
Example #2
Source File: formatQCMixedSites.ts From nextclade with MIT License | 6 votes |
export function formatQCMixedSites<TFunction extends TFunctionInterface>(
t: TFunction,
mixedSites?: DeepReadonly<QcResultMixedSites>,
) {
if (!mixedSites || mixedSites.status === QcStatus.good) {
return undefined
}
const { score, totalMixedSites, mixedSitesThreshold, status } = mixedSites
let message = t('Mixed sites found')
if (status === QcStatus.bad) {
message = t('Too many mixed sites found')
}
return t('{{message}}: total {{total}} ({{allowed}} allowed). QC score: {{score}}', {
message,
total: totalMixedSites,
allowed: mixedSitesThreshold,
score: round(score),
})
}
Example #3
Source File: formatQCPrivateMutations.ts From nextclade with MIT License | 6 votes |
export function formatQCPrivateMutations<TFunction extends TFunctionInterface>(
t: TFunction,
privateMutations?: DeepReadonly<QcResultPrivateMutations>,
) {
if (!privateMutations || privateMutations.status === QcStatus.good) {
return undefined
}
const {
score,
numReversionSubstitutions,
numLabeledSubstitutions,
numUnlabeledSubstitutions,
totalDeletionRanges,
weightedTotal,
} = privateMutations
return t(
'QC score: {{score}}. ' +
'Reverted substitutions: {{numReversionSubstitutions}}, ' +
'Labeled substitutions: {{numLabeledSubstitutions}}, ' +
'Unlabeled substitutions: {{numUnlabeledSubstitutions}}, ' +
'Deletion ranges: {{totalDeletionRanges}}. ' +
'Weighted total: {{weightedTotal}}',
{
score: round(score),
numReversionSubstitutions,
numLabeledSubstitutions,
numUnlabeledSubstitutions,
totalDeletionRanges,
weightedTotal,
},
)
}
Example #4
Source File: formatQCSNPClusters.ts From nextclade with MIT License | 6 votes |
export function formatQCSNPClusters<TFunction extends TFunctionInterface>(
t: TFunction,
snpClusters?: DeepReadonly<QcResultSnpClusters>,
) {
if (!snpClusters || snpClusters.status === QcStatus.good) {
return undefined
}
const { score, clusteredSNPs, totalSNPs, status } = snpClusters
let message = t('Mutation clusters found')
if (status === QcStatus.bad) {
message = t('Too many mutation clusters found')
}
return t('{{message}}. Seen {{nClusters}} mutation clusters with total of {{total}} mutations. QC score: {{score}}', {
message,
total: totalSNPs,
nClusters: clusteredSNPs.length,
score: round(score),
})
}
Example #5
Source File: cross-chain-trade-providers-data.ts From rubic-sdk with GNU General Public License v3.0 | 4 votes |
crossChainTradeProvidersData: DeepReadonly<
Record<string, { ProviderClass: typeof InstantTradeProvider; methodSuffix: string }[]>
> = {
[BLOCKCHAIN_NAME.ETHEREUM]: [
{
ProviderClass: UniSwapV2EthereumProvider,
methodSuffix: ''
},
{
ProviderClass: SushiSwapEthereumProvider,
methodSuffix: '1'
},
{
ProviderClass: UniSwapV3EthereumProvider,
methodSuffix: 'V3'
},
{
ProviderClass: OneinchEthereumProvider,
methodSuffix: 'Inch'
}
],
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: [
{
ProviderClass: PancakeSwapProvider,
methodSuffix: ''
},
{
ProviderClass: SushiSwapBscProvider,
methodSuffix: '1'
},
{
ProviderClass: OneinchBscProvider,
methodSuffix: 'Inch'
}
],
[BLOCKCHAIN_NAME.POLYGON]: [
{
ProviderClass: QuickSwapProvider,
methodSuffix: ''
},
{
ProviderClass: SushiSwapPolygonProvider,
methodSuffix: '1'
},
{
ProviderClass: UniSwapV3PolygonProvider,
methodSuffix: 'V3'
},
{
ProviderClass: AlgebraProvider,
methodSuffix: 'ALGB'
},
{
ProviderClass: OneinchPolygonProvider,
methodSuffix: 'Inch'
}
],
[BLOCKCHAIN_NAME.AVALANCHE]: [
{
ProviderClass: PangolinProvider,
methodSuffix: 'AVAX'
},
{
ProviderClass: JoeProvider,
methodSuffix: 'AVAX1'
},
{
ProviderClass: SushiSwapAvalancheProvider,
methodSuffix: ''
}
],
[BLOCKCHAIN_NAME.MOONRIVER]: [
{
ProviderClass: SolarbeamProvider,
methodSuffix: ''
},
{
ProviderClass: SushiSwapMoonriverProvider,
methodSuffix: '1'
}
],
[BLOCKCHAIN_NAME.FANTOM]: [
{
ProviderClass: SpookySwapProvider,
methodSuffix: ''
},
{
ProviderClass: SpiritSwapProvider,
methodSuffix: '1'
},
{
ProviderClass: SushiSwapFantomProvider,
methodSuffix: '2'
}
],
[BLOCKCHAIN_NAME.HARMONY]: [
{
ProviderClass: SushiSwapHarmonyProvider,
methodSuffix: ''
},
{
ProviderClass: ViperSwapHarmonyProvider,
methodSuffix: '1'
}
],
[BLOCKCHAIN_NAME.ARBITRUM]: [
{
ProviderClass: SushiSwapArbitrumProvider,
methodSuffix: ''
},
{
ProviderClass: UniSwapV3ArbitrumProvider,
methodSuffix: 'V3'
},
{
ProviderClass: OneinchArbitrumProvider,
methodSuffix: 'Inch'
}
],
[BLOCKCHAIN_NAME.AURORA]: [
{
ProviderClass: TrisolarisAuroraProvider,
methodSuffix: ''
},
{
ProviderClass: WannaSwapAuroraProvider,
methodSuffix: '1'
}
],
[BLOCKCHAIN_NAME.TELOS]: [
{
ProviderClass: SushiSwapTelosProvider,
methodSuffix: ''
},
{
ProviderClass: ZappyProvider,
methodSuffix: '1'
}
]
} as const