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

x/ayonli_jsext/path.ts>join

A JavaScript extension package for building strong and modern applications.
Latest
function join
import { join } from "https://deno.land/x/ayonli_jsext@v0.9.72/path.ts";

Concatenates all given segments into a well-formed path.

Examples

Example 1

import { join } from "@ayonli/jsext/path";

console.log(join("foo", "bar")); // "foo/bar" or "foo\\bar" on Windows
console.log(join("/", "foo", "bar")); // "/foo/bar"
console.log(join("C:\\", "foo", "bar")); // "C:\\foo\\bar"
console.log(join("file:///foo", "bar", "..")) // "file:///foo"

console.log(join("http://example.com", "foo", "bar", "?query"));
// "http://example.com/foo/bar?query"

Parameters

...segments: string[]

Returns

string