Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed May 8, 2024
1 parent a76a7e9 commit 4a0453a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
5 changes: 0 additions & 5 deletions env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export default env;
* > | Deno | Environment Variable (`allow-env`) | All |
* @param {string} key Key of the environment variable.
* @returns {void}
* @deprecated Replaced by method {@linkcode env.delete}.
*/
export function deleteEnv(key: string): void {
return env.delete(key);
Expand All @@ -131,7 +130,6 @@ export function deleteEnv(key: string): void {
* > |:--|:--|:--|
* > | Deno | Environment Variable (`allow-env`) | All |
* @returns {{ [key: string]: string; }} A snapshot of the environment variables.
* @deprecated Replaced by method {@linkcode env.getAll}.
*/
export function getAllEnv(): { [key: string]: string; } {
return env.getAll();
Expand All @@ -146,7 +144,6 @@ export function getAllEnv(): { [key: string]: string; } {
* > | Deno | Environment Variable (`allow-env`) | All |
* @param {string} key Key of the environment variable.
* @returns {string | undefined} Value of the environment variable.
* @deprecated Replaced by method {@linkcode env.get}.
*/
export function getEnv(key: string): string | undefined {
return env.get(key);
Expand All @@ -161,7 +158,6 @@ export function getEnv(key: string): string | undefined {
* > | Deno | Environment Variable (`allow-env`) | All |
* @param {string} key Key of the environment variable.
* @returns {boolean} Determine result.
* @deprecated Replaced by method {@linkcode env.has}.
*/
export function hasEnv(key: string): boolean {
return env.has(key);
Expand All @@ -177,7 +173,6 @@ export function hasEnv(key: string): boolean {
* @param {string} key Key of the environment variable.
* @param {string} value Value of the environment variable.
* @returns {void}
* @deprecated Replaced by method {@linkcode env.set}.
*/
export function setEnv(key: string, value: string): void {
return env.set(key, value);
Expand Down
5 changes: 4 additions & 1 deletion is_root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import process from "node:process";
* @returns {boolean} Determine result.
*/
export function isEnvironmentRoot(): boolean {
return (process.getuid?.() === 0);
return (
(typeof Deno !== "undefined" && Deno.uid() === 0) ||
process.getuid?.() === 0
);
}
export default isEnvironmentRoot;
10 changes: 8 additions & 2 deletions is_wsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const regexpWordMicrosoft = /microsoft/i;
* @returns {Promise<boolean>} Determine result.
*/
export async function isEnvironmentWSL(): Promise<boolean> {
if (process.platform !== "linux") {
if (
(typeof Deno !== "undefined" && Deno.build.os !== "linux") ||
process.platform !== "linux"
) {
return false;
}
try {
Expand All @@ -34,7 +37,10 @@ export default isEnvironmentWSL;
* @returns {boolean} Determine result.
*/
export function isEnvironmentWSLSync(): boolean {
if (process.platform !== "linux") {
if (
(typeof Deno !== "undefined" && Deno.build.os !== "linux") ||
process.platform !== "linux"
) {
return false;
}
try {
Expand Down
1 change: 1 addition & 0 deletions npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"scripts": {
"build": "tsc"
},
"dependencies": { },
"devDependencies": {
"typescript": "^5.4.5"
},
Expand Down
5 changes: 4 additions & 1 deletion pathext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import process from "node:process";
import { envDelimitation } from "./_delimitation.ts";
const isOSWindows: boolean = process.platform === "win32";
const isOSWindows: boolean = (
(typeof Deno !== "undefined" && Deno.build.os === "windows") ||
process.platform === "win32"
);
/**
* Cross runtime environment variables `PATHEXT` interface.
*
Expand Down

0 comments on commit 4a0453a

Please sign in to comment.