url-component-join
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

URL Component Join

normalize and join url components

Installation

npm install --save url-component-join

Functions

normalize(path: string): string

Normalizes the given path, remove redundant / and resolving .. and . segments.

import { normalize } from 'url-component-join';

normalize('//a/a/..//b.c');
// /a/b.c

join(...paths: Array<string>): string

Normalize and join several segments into one path

import { join } from 'url-component-join';

join('//a/a/', '..', '//b.c');
// /a/b.c

join('http://127.0.0.1:8080/a//b', '//c///d')
// http://127.0.0.1:8080/a/b/c/d

join('http://127.0.0.1:8080/a//b', 'http://127.0.0.1:8080//c///d')
// http://127.0.0.1:8080/a/b/c/d

basename(path: string): string

dirname(path: string): string

relative(from: string, to: string): string

Readme

Keywords

Package Sidebar

Install

npm i url-component-join

Weekly Downloads

0

Version

0.0.5

License

UNLICENSED

Unpacked Size

26.1 kB

Total Files

15

Last publish

Collaborators

  • hungtcs