diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-09-01 19:56:08 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-09-01 19:56:08 +0530 |
commit | 7f4ebca0c4330805ea8f3821dba075b34dd2be58 (patch) | |
tree | 39e9c0994969565ab9a227494beaf5e830315e9a /packages/taler-wallet-core/src/util/codec.ts | |
parent | 62406304d9a81a08797c09f5151de74d8ca43fe8 (diff) | |
download | wallet-core-7f4ebca0c4330805ea8f3821dba075b34dd2be58.tar.xz |
validation
Diffstat (limited to 'packages/taler-wallet-core/src/util/codec.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/codec.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/util/codec.ts b/packages/taler-wallet-core/src/util/codec.ts index 111abc38c..741a5b172 100644 --- a/packages/taler-wallet-core/src/util/codec.ts +++ b/packages/taler-wallet-core/src/util/codec.ts @@ -292,15 +292,17 @@ export function codecForNumber(): Codec<number> { /** * Return a codec for a value that must be a number. */ -export const codecForBoolean: Codec<boolean> = { - decode(x: any, c?: Context): boolean { - if (typeof x === "boolean") { - return x; - } - throw new DecodingError( - `expected boolean at ${renderContext(c)} but got ${typeof x}`, - ); - }, +export function codecForBoolean(): Codec<boolean> { + return { + decode(x: any, c?: Context): boolean { + if (typeof x === "boolean") { + return x; + } + throw new DecodingError( + `expected boolean at ${renderContext(c)} but got ${typeof x}`, + ); + }, + } }; /** |