UNPKG

@coko/server

Version:

Reusable server for use by Coko's projects

23 lines 654 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.env = env; function env(name, options = {}) { const value = process.env[name]; if (options.type === 'boolean') { if (value) return true; return false; } if (options.type === 'number') { const num = Number(value); /* eslint-disable-next-line consistent-return */ if (isNaN(num)) return; return num; } /* eslint-disable-next-line consistent-return */ if (typeof value === 'string' && value.length === 0) return; return value; } //# sourceMappingURL=env.js.map