refactor: rewrite on typescript
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
import path from "path";
|
||||
|
||||
export class Env {
|
||||
static set(key: string, value: string) {
|
||||
process.env[key] = value;
|
||||
}
|
||||
|
||||
static get(key: string) {
|
||||
return process.env[key];
|
||||
}
|
||||
|
||||
static addPath(value: string, key = "PATH") {
|
||||
if (!process.env[key]) {
|
||||
process.env[key] = value;
|
||||
} else if (process.env[key].split(path.delimiter).indexOf(value) === -1) {
|
||||
process.env[key] = [process.env[key], value].join(path.delimiter);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user