aboutsummaryrefslogtreecommitdiff
path: root/src/util/helpers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/helpers.ts')
-rw-r--r--src/util/helpers.ts19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/util/helpers.ts b/src/util/helpers.ts
index 722688d35..130dcdaef 100644
--- a/src/util/helpers.ts
+++ b/src/util/helpers.ts
@@ -34,7 +34,6 @@ export function amountToPretty(amount: AmountJson): string {
return `${x} ${amount.currency}`;
}
-
/**
* Canonicalize a base url, typically for the exchange.
*
@@ -53,7 +52,6 @@ export function canonicalizeBaseUrl(url: string) {
return x.href;
}
-
/**
* Convert object to JSON with canonical ordering of keys
* and whitespace omitted.
@@ -84,7 +82,6 @@ export function canonicalJson(obj: any): string {
return s + "}";
}
-
/**
* Check for deep equality of two objects.
* Only arrays, objects and primitives are supported.
@@ -99,11 +96,12 @@ export function deepEquals(x: any, y: any): boolean {
}
const p = Object.keys(x);
- return Object.keys(y).every((i) => p.indexOf(i) !== -1) &&
- p.every((i) => deepEquals(x[i], y[i]));
+ return (
+ Object.keys(y).every((i) => p.indexOf(i) !== -1) &&
+ p.every((i) => deepEquals(x[i], y[i]))
+ );
}
-
/**
* Map from a collection to a list or results and then
* concatenate the results.
@@ -125,12 +123,11 @@ export function hash(val: any): number {
}
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
- * integers. Since we want the results to be always positive, convert the
- * signed int to an unsigned by doing an unsigned bitshift. */
+ * integers. Since we want the results to be always positive, convert the
+ * signed int to an unsigned by doing an unsigned bitshift. */
return h >>> 0;
}
-
/**
* Lexically compare two strings.
*/
@@ -146,10 +143,10 @@ export function strcmp(s1: string, s2: string): number {
/**
* Run a function and return its result.
- *
+ *
* Used as a nicer-looking way to do immediately invoked function
* expressions (IFFEs).
*/
export function runBlock<T>(f: () => T) {
return f();
-} \ No newline at end of file
+}