-
-
Notifications
You must be signed in to change notification settings - Fork 265
Expand file tree
/
Copy pathenv.js
More file actions
27 lines (19 loc) · 528 Bytes
/
Copy pathenv.js
File metadata and controls
27 lines (19 loc) · 528 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import {env} from 'node:process';
import snake from 'just-snake-case';
const up = (a) => a.toUpperCase();
export const bool = (name) => {
const value = parse(name);
if (value === 'true')
return true;
if (value === '1')
return true;
if (value === 'false')
return false;
if (value === '0')
return false;
};
export const parse = (name) => {
const small = `cloudcmd_${snake(name)}`;
const big = up(small);
return env[big] || env[small];
};