0.0.5 • Published 3 years ago
url-component-join v0.0.5
URL Component Join
normalize and join url components
Installation
npm install --save url-component-joinFunctions
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.cjoin(...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