Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

How to join all url segments to make a url in javascipt 30seconds of code

const URLJoin = (...args) =>
  args
    .join('/')
    .replace(/[/]+/g, '/')
    .replace(/^(.+)://, '$1://')
    .replace(/^file:/, 'file:/')
    .replace(//(?|&|#[^!])/g, '$1')
    .replace(/?/g, '&')
    .replace('&', '?');
Comment

PREVIOUS NEXT
Code Example
Typescript :: conditional statements in ti-82 
Typescript :: .env.local is not working inside useEffect 
Typescript :: palindromic no. 
Typescript :: python double check if wants to execute funtion 
Typescript :: subplots in for loop python (no dynamic) 
Typescript :: when should you stop testing 
Typescript :: does pure water contain natturaly occuring minerals? 
Typescript :: Exclude code from hints delphi 7 
Typescript :: install typeorm ts 
Typescript :: Link renders blank page 
Typescript :: how to bold to custom fonts on Online 
Typescript :: sequelize puts an s end of name 
Typescript :: enum to number typescript 
Typescript :: Define an array as an environment variable 
Typescript :: HOC Generic using React Typescript 
Typescript :: laravel orm fetures 
Typescript :: branching statements in python 
Typescript :: e.target.value typescript 
Typescript :: how to find geopoints radius in mongoose 
Typescript :: Define a function sum_two_gr with three arguments returning the sum of the greatest two python 
Typescript :: recharts direction 
Typescript :: typescript for vue 
Typescript :: render html contents from url in asp.net razor 
Typescript :: loading assets in ionic react 
Typescript :: element of an array is the same as any of the previous elements pandas 
Typescript :: What are the different way to produce reports for TestNG results? 
Typescript :: js Validating nested promises 
Typescript :: requests session next page python 
Typescript :: input non-negative decimal in typescript 
Typescript :: c# check type implements generic interface 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =