Add URLJoin.md

This commit is contained in:
Angelos Chalaris
2018-01-16 15:53:03 +02:00
parent 53bc1042ff
commit fca48e797e
5 changed files with 574 additions and 524 deletions

8
test/URLJoin/URLJoin.js Normal file
View File

@ -0,0 +1,8 @@
module.exports = URLJoin = (...args) =>
args.join('/')
.replace(/[\/]+/g,'/')
.replace(/^(.+):\//,'$1://')
.replace(/^file:/,'file:/')
.replace(/\/(\?|&|#[^!])/g, '$1')
.replace(/\?/g,'&')
.replace('&','?');