url-parse-auth
Parse the password and user out of a url. Do in one step what would take two steps and a string.split with
require('url')
.
Install
$ npm install --save url-parse-auth
Usage
var urlParseAuth = require('url-parse-auth')
urlParseAuth('https://user:[email protected]')
//=> {user: 'user', pass: 'pass'}
API
urlParsePassword(url)
-> {user, password}
Both user
and password
will be undefined if the url has no auth section.
License
MIT © Andrew Joslin