diff --git a/src/index.js b/src/index.js index 5bf8118..74abea0 100644 --- a/src/index.js +++ b/src/index.js @@ -3,11 +3,13 @@ // PushAdapter, it uses GCM for android push, APNS for ios push. // WEB for web push. import log from 'npmlog'; +import { booleanParser } from './utils.js'; -/* istanbul ignore if */ -if (process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER) { +/* c8 ignore start */ +if (booleanParser(process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER)) { log.level = 'verbose'; } +/* c8 ignore stop */ import ParsePushAdapter from './ParsePushAdapter.js'; import GCM from './GCM.js'; diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..01fc659 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,10 @@ +function booleanParser(opt) { + if (opt == true || opt == 'true' || opt == '1') { + return true; + } + return false; +} + +export { + booleanParser, +}