From 706c07fa1d069290992bd31d53b0c89324992f9c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 28 Nov 2019 00:46:34 +0100 Subject: implement JS-only Taler, remove emscripten --- src/helpers.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/helpers.ts') diff --git a/src/helpers.ts b/src/helpers.ts index cfebf394f..1983cee9b 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -139,6 +139,17 @@ export function extractTalerStamp(stamp: string): Timestamp | undefined { }; } +/** + * Extract a timestamp from a Taler timestamp string. + */ +export function extractTalerStampOrThrow(stamp: string): Timestamp { + const r = extractTalerStamp(stamp); + if (!r) { + throw Error("invalid time stamp"); + } + return r; +} + /** * Check if a timestamp is in the right format. */ -- cgit v1.2.3