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

x/ayonli_jsext/path.ts>split

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

Splits the path into well-formed segments.

Examples

Example 1

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

console.log(split("/usr/bin")); // ["/", "usr", "bin"]
console.log(split("C:\\Windows\\System32")); // ["C:\\", "Windows", "System32"]
console.log(split("file:///user/bin")); // ["file:///", "usr", "bin"]

console.log(split("http://example.com/foo/bar?foo=bar#baz"));
// ["http://example.com", "foo", "bar", "?foo=bar", "#baz"]

Parameters

path: string

Returns

string[]