diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-04-06 23:32:01 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-04-06 23:32:01 +0530 |
commit | 47787c0b0b846d5f4a057661efdd05d8786032f1 (patch) | |
tree | 3a3d58a5ebad8af584de6a6cd882c2019f71dffa /src/util/amounts.ts | |
parent | f36bb7a04eabe0330cb166bf9ce5021c92f38dc8 (diff) | |
download | wallet-core-47787c0b0b846d5f4a057661efdd05d8786032f1.tar.xz |
make linter less grumpy
Diffstat (limited to 'src/util/amounts.ts')
-rw-r--r-- | src/util/amounts.ts | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/util/amounts.ts b/src/util/amounts.ts index f0a4f1d72..da1c19233 100644 --- a/src/util/amounts.ts +++ b/src/util/amounts.ts @@ -22,10 +22,10 @@ * Imports. */ import { - typecheckedCodec, makeCodecForObject, codecForString, codecForNumber, + Codec, } from "./codec"; /** @@ -66,14 +66,12 @@ export interface AmountJson { readonly currency: string; } -export const codecForAmountJson = () => - typecheckedCodec<AmountJson>( +export const codecForAmountJson = (): Codec<AmountJson> => makeCodecForObject<AmountJson>() .property("currency", codecForString) .property("value", codecForNumber) .property("fraction", codecForNumber) - .build("AmountJson"), - ); + .build("AmountJson"); /** * Result of a possibly overflowing operation. @@ -100,7 +98,7 @@ export function getZero(currency: string): AmountJson { }; } -export function sum(amounts: AmountJson[]) { +export function sum(amounts: AmountJson[]): Result { if (amounts.length <= 0) { throw Error("can't sum zero amounts"); } @@ -287,7 +285,7 @@ export function parseOrThrow(s: string): AmountJson { * Convert a float to a Taler amount. * Loss of precision possible. */ -export function fromFloat(floatVal: number, currency: string) { +export function fromFloat(floatVal: number, currency: string): AmountJson { return { currency, fraction: Math.floor((floatVal - Math.floor(floatVal)) * fractionalBase), |