UNPKG

env-var

Version:

Verification, sanitization, and type coercion for environment variables in Node.js

12 lines (8 loc) 253 B
'use strict' module.exports = function asBoolStrict (value) { const val = value.toLowerCase() if ((val !== 'false') && (val !== 'true')) { throw new Error('should be either "true", "false", "TRUE", or "FALSE"') } return val !== 'false' }