Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/node/path.ts>common

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function common
import { common } from "https://deno.land/std@0.87.0/node/path.ts";

Determines the common path from a set of paths, using an optional separator, which defaults to the OS default separator.

  import { common } from "https://deno.land/std/path/mod.ts";
  const p = common([
    "./deno/std/path/mod.ts",
    "./deno/std/fs/mod.ts",
  ]);
  console.log(p); // "./deno/std/"

Parameters

paths: string[]
optional
sep = [UNSUPPORTED]

Returns

string