All files / path / _common / env.ts

50.00% Branches 2/4
100.00% Functions 1/1
62.50% Lines 5/8
1
2
3
4
5
6
7
8
9
10
11
 
 
x79
 
x24
x24
 
 
 
x24
x24




I
I



// Copyright 2018-2026 the Deno authors. MIT license.

export function cwd(errorMessage: string): string {
  // deno-lint-ignore no-explicit-any
  const global = globalThis as any;
  const getCwd = global.process?.cwd ?? global.Deno?.cwd;
  if (typeof getCwd !== "function") {
    throw new TypeError(errorMessage);
  }
  return getCwd();
}