Files
airllm-fork-nodejs/node_modules/env-var/lib/accessors/bool.js
2026-02-05 15:27:49 +08:00

19 lines
346 B
JavaScript

'use strict'
module.exports = function asBool (value) {
const val = value.toLowerCase()
const allowedValues = [
'false',
'0',
'true',
'1'
]
if (allowedValues.indexOf(val) === -1) {
throw new Error('should be either "true", "false", "TRUE", "FALSE", 1, or 0')
}
return !(((val === '0') || (val === 'false')))
}