You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,31 +28,31 @@ export PRIMES="2,3,5,7"
28
28
Get and use them:
29
29
30
30
```javascript
31
-
var getenv =require('getenv');
31
+
constgetenv=require('getenv');
32
32
33
-
var host =getenv('HTTP_HOST'); // same as getenv.string('HTTP_HOST');
34
-
var port =getenv.int('HTTP_PORT');
35
-
var start =getenv.bool('HTTP_START');
33
+
consthost=getenv('HTTP_HOST'); // same as getenv.string('HTTP_HOST');
34
+
constport=getenv.int('HTTP_PORT');
35
+
conststart=getenv.bool('HTTP_START');
36
36
37
37
if (start ===true) {
38
-
//var server = http.createServer();
38
+
//const server = http.createServer();
39
39
// server.listen(port, host);
40
40
}
41
41
42
-
var abTestRatio =getenv.float('AB_TEST_RATIO');
42
+
constabTestRatio=getenv.float('AB_TEST_RATIO');
43
43
44
44
if (Math.random() < abTestRatio) {
45
45
// test A
46
46
} else {
47
47
// test B
48
48
}
49
49
50
-
var keywords =getenv.array('KEYWORDS');
50
+
constkeywords=getenv.array('KEYWORDS');
51
51
keywords.forEach(function(keyword) {
52
52
// console.log(keyword);
53
53
});
54
54
55
-
var primes =getenv.array('PRIMES', 'int');
55
+
constprimes=getenv.array('PRIMES', 'int');
56
56
primes.forEach(function(prime) {
57
57
// console.log(prime, typeof prime);
58
58
});
@@ -95,7 +95,7 @@ Split value of the environment variable at each comma and return the resulting a
95
95
Return a list of environment variables based on a `spec`:
96
96
97
97
```javascript
98
-
var config =getenv.multi({
98
+
constconfig=getenv.multi({
99
99
foo:'FOO', // throws if FOO doesn't exist
100
100
bar: ['BAR', 'defaultval'], // set a default value
101
101
baz: ['BAZ', 'defaultval', 'string'], // parse into type
@@ -108,7 +108,7 @@ var config = getenv.multi({
108
108
Return a parsed URL as per Node's `require("url").parse`. N.B `url` doesn't validate URLs, so be sure it includes a protocol or you'll get deeply weird results.
0 commit comments