UNPKG

kurl

Version:

It's a powerfull URL parser written in JavaScript and compatible with NodeJS with a lot of features that it will help you to modify/parse easily a URL without any problem.

38 lines (21 loc) 512 B
// var URL = require('kurl'); var URL = require('../url.js'); console.log( '\nExample 1\n\n', URL('http://guest:secret@remote:21/filename?a=1#ok').attr() ); console.log( '\nExample 2\n\n', URL('http://youtu.be').attr('protocol', 'https').attr({ pathname: '/iCkYw3cRwLo', search: { t: '22s' }, hash: { hello : 'world' } }).href() ); console.log( '\nExample 3\n\n', URL('second.html', { hostname: 'localhost', pathname: '/first/' }).href() );