aboutsummaryrefslogtreecommitdiff
path: root/src/helpers.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-11-28 00:46:34 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-11-28 00:46:34 +0100
commit706c07fa1d069290992bd31d53b0c89324992f9c (patch)
tree8114c23cda7547f8475c7d8d579f51f968a97f9d /src/helpers.ts
parentc3ca556affe2f514aeb7fd052fe6d626d9319e99 (diff)
downloadwallet-core-706c07fa1d069290992bd31d53b0c89324992f9c.tar.xz
implement JS-only Taler, remove emscripten
Diffstat (limited to 'src/helpers.ts')
-rw-r--r--src/helpers.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/helpers.ts b/src/helpers.ts
index cfebf394f..1983cee9b 100644
--- a/src/helpers.ts
+++ b/src/helpers.ts
@@ -140,6 +140,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.
*/
export function timestampCheck(stamp: string): boolean {