aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 10:35:11 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-12 10:37:30 +0800
commit870995933a60b67af03b3f42a2aed169d33bd87f (patch)
tree2c8c583434080413dbb8aede8de515d5ed7e05ef /packages/dev-utils/src
parentd6c2e47bbd099f380c8fd4790d6d7be17d3532e5 (diff)
downloaddexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar.gz
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar.bz2
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar.lz
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar.xz
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.tar.zst
dexon-sol-tools-870995933a60b67af03b3f42a2aed169d33bd87f.zip
Remove redundant Date.now()
Diffstat (limited to 'packages/dev-utils/src')
-rw-r--r--packages/dev-utils/src/env.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/dev-utils/src/env.ts b/packages/dev-utils/src/env.ts
new file mode 100644
index 000000000..7e46a5f89
--- /dev/null
+++ b/packages/dev-utils/src/env.ts
@@ -0,0 +1,19 @@
+import * as _ from 'lodash';
+import * as process from 'process';
+
+export const env = {
+ parseBoolean(key: string): boolean {
+ let isTrue: boolean;
+ const envVarvalue = process.env[key];
+ if (process.env.SOLIDITY_COVERAGE === 'true') {
+ isTrue = true;
+ } else if (process.env.SOLIDITY_COVERAGE === 'false' || _.isUndefined(process.env.SOLIDITY_COVERAGE)) {
+ isTrue = false;
+ } else {
+ throw new Error(
+ `Failed to parse ENV variable ${key} as boolean. Please make sure it's either true or false. Defaults to false`,
+ );
+ }
+ return isTrue;
+ },
+};