How to use the trim function from url

Find comprehensive JavaScript url.trim code examples handpicked from public code repositorys.

9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
module.exports = function (url) {
	if (typeof url !== 'string') {
		throw new TypeError('Expected a string, got ' + typeof url);
	}


	url = url.trim();


	if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
		return url;
	}
fork icon0
star icon0
watch icon1