mirror of
https://github.com/jht5945/rust_util.git
synced 2025-12-27 15:40:03 +08:00
ref is_env_on
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
use std::env;
|
||||
|
||||
pub fn is_env_on(var: &str) -> bool {
|
||||
env::var(var).map(|v| v.to_lowercase()).map(|v| (v == "true" || v == "yes" || v == "1")).unwrap_or(false)
|
||||
env::var(var).map(|v| v.to_lowercase()).map(|v| vec!["true", "yes", "1"].iter().any(|x| x == &v)).unwrap_or(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user