From 870995933a60b67af03b3f42a2aed169d33bd87f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 12 Mar 2018 03:35:11 +0100 Subject: Remove redundant Date.now() --- packages/dev-utils/src/env.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 packages/dev-utils/src/env.ts (limited to 'packages/dev-utils/src') 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; + }, +}; -- cgit